diff --git a/src/utils/api/gymApplication.ts b/src/utils/api/gymApplication.ts index d5afd3ec2825dcc3d76eb5ace244190ad86dbc4c..93ec8b608ece4d44ba278dc757daffc79f1c9f49 100644 --- a/src/utils/api/gymApplication.ts +++ b/src/utils/api/gymApplication.ts @@ -1,3 +1,6 @@ +import axios from "axios"; +import config from "../config"; +import { header } from "."; import { GymApplicationFetched, GymApplicationReturned, @@ -5,7 +8,7 @@ import { } from "../validationSchema/gymApplication"; 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) { myResolve([ { @@ -40,7 +43,10 @@ export async function applyToGym({ gym_id, gym_name, }: 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) { myResolve({ acceptance: 0, diff --git a/src/utils/api/job.ts b/src/utils/api/job.ts index 12191d4382a19f5aee6b8dad560f9c2a024a8fd3..339c034a7de83095ccff1ac6e0462215e6f959a7 100644 --- a/src/utils/api/job.ts +++ b/src/utils/api/job.ts @@ -9,6 +9,6 @@ export async function resign({ username: string; }): Promise<UserReturned> { 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; }