Skip to content
Snippets Groups Projects
Commit 5b71aa3c authored by Fatih20's avatar Fatih20
Browse files

Merge branch 'main' of gitlab.informatika.org:if3110-2023-02-39/react-spa into main

parents f5b6338f 692f8f97
No related merge requests found
import axios from "axios";
import config from "../config";
import { header } from ".";
import { import {
GymApplicationFetched, GymApplicationFetched,
GymApplicationReturned, GymApplicationReturned,
...@@ -5,7 +8,7 @@ import { ...@@ -5,7 +8,7 @@ import {
} from "../validationSchema/gymApplication"; } from "../validationSchema/gymApplication";
export async function getGymApplication(): Promise<GymApplicationReturned[]> { export async function getGymApplication(): Promise<GymApplicationReturned[]> {
// return (await axios.get(`${config.NODE_JS_API}/api/gym/`, header)).data; // const res = (await axios.get(`${config.NODE_JS_API}/api/job/${username}`, header));
const myPromise = new Promise<GymApplicationFetched[]>(function (myResolve) { const myPromise = new Promise<GymApplicationFetched[]>(function (myResolve) {
myResolve([ myResolve([
{ {
...@@ -40,7 +43,10 @@ export async function applyToGym({ ...@@ -40,7 +43,10 @@ export async function applyToGym({
gym_id, gym_id,
gym_name, gym_name,
}: GymApplicationSent): Promise<GymApplicationReturned> { }: GymApplicationSent): Promise<GymApplicationReturned> {
// return (await axios.get(`${config.NODE_JS_API}/api/gym/`, header)).data; const res = (await (await axios.post(`${config.NODE_JS_API}/api/job/apply`, header)).data);
if (res.status !== 200) {
throw new Error("Failed to apply to gym");
}
const myPromise = new Promise<GymApplicationReturned>(function (myResolve) { const myPromise = new Promise<GymApplicationReturned>(function (myResolve) {
myResolve({ myResolve({
acceptance: 0, acceptance: 0,
......
...@@ -9,6 +9,6 @@ export async function resign({ ...@@ -9,6 +9,6 @@ export async function resign({
username: string; username: string;
}): Promise<UserReturned> { }): Promise<UserReturned> {
return ( return (
await axios.patch(`${config.NODE_JS_API}/api/job/${username}`, {}, header) await axios.patch(`${config.NODE_JS_API}/api/job/resign/${username}`, {}, header)
).data.user; ).data.user;
} }
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment