diff --git a/src/utils/api/gymApplication.ts b/src/utils/api/gymApplication.ts index c317ca8a0711000b7290d3ae17e23167170abffa..178c6378cf06a0b9b97bd540b2b22ca880bcde36 100644 --- a/src/utils/api/gymApplication.ts +++ b/src/utils/api/gymApplication.ts @@ -45,29 +45,25 @@ export async function applyToGym({ username, email, trainer_name, - description, + trainer_description, }: GymApplicationSent): Promise<GymApplicationReturned> { const reqBody = { - gym_name, - username, - gym_id, - email, - trainer_name, - description, - application_description, + gym_name, + username, + gym_id, + email, + trainer_name, + trainer_description, + application_description, }; - const res = (await axios.post(`${config.NODE_JS_API}/api/job/apply`, reqBody, header)); + const res = await axios.post( + `${config.NODE_JS_API}/api/job/apply`, + reqBody, + header + ); if (res.status !== 200) { throw new Error("Failed to apply to gym"); } - const myPromise = new Promise<GymApplicationReturned>(function (myResolve) { - myResolve({ - acceptance: 0, - description: application_description, - gymId: gym_id, - gymName: gym_name, - }); - }); - return myPromise; + return res.data; } diff --git a/src/utils/validationSchema/gymApplication.ts b/src/utils/validationSchema/gymApplication.ts index 6214f6129ad2310105476415ba6107f26c2a4f5b..4e3935f2547534364d4d1b0cf59e4c7acc416225 100644 --- a/src/utils/validationSchema/gymApplication.ts +++ b/src/utils/validationSchema/gymApplication.ts @@ -19,6 +19,7 @@ const gymApplicationSentSchema = gymApplicationFetchedSchema trainer_name: z.string().max(50), trainer_description: z.string().max(255), username: z.string().max(50), + email: z.string().email(), }) .omit({ acceptance: true,