diff --git a/src/models/climbing-route-rating/climbing_gyms/climbingGyms.router.ts b/src/models/climbing-route-rating/climbing_gyms/climbingGyms.router.ts index dd039b6..1df320d 100644 --- a/src/models/climbing-route-rating/climbing_gyms/climbingGyms.router.ts +++ b/src/models/climbing-route-rating/climbing_gyms/climbingGyms.router.ts @@ -127,7 +127,8 @@ climbingGymRouter.post('/', async (req: Request, res: Response) => { } // Verify captcha - if (!await verifyCaptcha(captcha_token)) { + let success = await verifyCaptcha(captcha_token); + if (!success) { res.status(403).send({'message': 'Invalid Captcha. Please try again.'}); return; } diff --git a/src/models/climbing-route-rating/climbing_gyms/climbingGyms.service.ts b/src/models/climbing-route-rating/climbing_gyms/climbingGyms.service.ts index 14e4a9d..6fe5d50 100644 --- a/src/models/climbing-route-rating/climbing_gyms/climbingGyms.service.ts +++ b/src/models/climbing-route-rating/climbing_gyms/climbingGyms.service.ts @@ -26,7 +26,7 @@ export const createGym = async (name: string, city: string): Promise => try { let res = await conn.query('INSERT INTO climbing_gyms (name, city) VALUES (?, ?) RETURNING gym_id', [name, city]); - return res[0].hall_id; + return res[0].gym_id; } catch (err) { throw err; } diff --git a/src/models/climbing-route-rating/common/VerifyCaptcha.ts b/src/models/climbing-route-rating/common/VerifyCaptcha.ts index 73cfea8..3922b95 100644 --- a/src/models/climbing-route-rating/common/VerifyCaptcha.ts +++ b/src/models/climbing-route-rating/common/VerifyCaptcha.ts @@ -10,13 +10,6 @@ export const verifyCaptcha = async (captcha_token: string): Promise => secret: process.env.HCAPTCHA_SECRET }); - axios.post('https://hcaptcha.com/siteverify', postData) - .then(res => { - return res.data.success; - }) - .catch(error => { - throw(error); - }); - - return false; + let res = await axios.post('https://hcaptcha.com/siteverify', postData); + return res.data.success; };