This commit is contained in:
parent
924d16a1a4
commit
9c234e6994
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -26,7 +26,7 @@ export const createGym = async (name: string, city: string): Promise<number> =>
|
|||
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;
|
||||
}
|
||||
|
|
|
@ -10,13 +10,6 @@ export const verifyCaptcha = async (captcha_token: string): Promise<boolean> =>
|
|||
secret: process.env.HCAPTCHA_SECRET
|
||||
});
|
||||
|
||||
axios.post('https://hcaptcha.com/siteverify', postData)
|
||||
.then(res => {
|
||||
let res = await axios.post('https://hcaptcha.com/siteverify', postData);
|
||||
return res.data.success;
|
||||
})
|
||||
.catch(error => {
|
||||
throw(error);
|
||||
});
|
||||
|
||||
return false;
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue
Block a user