Skip to content

Commit

Permalink
Update SignUp.tsx and Checkout.tsx
Browse files Browse the repository at this point in the history
  • Loading branch information
aelassas committed Jun 13, 2024
1 parent 1c22266 commit b309b2d
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 8 deletions.
13 changes: 9 additions & 4 deletions frontend/src/pages/Checkout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -221,10 +221,15 @@ const Checkout = () => {
}

const handleRecaptchaVerify = useCallback(async (token: string) => {
const ip = await UserService.getIP()
const status = await UserService.verifyRecaptcha(token, ip)
const valid = status === 200
setRecaptchaError(!valid)
try {
const ip = await UserService.getIP()
const status = await UserService.verifyRecaptcha(token, ip)
const valid = status === 200
setRecaptchaError(!valid)
} catch (err) {
helper.error(err)
setRecaptchaError(true)
}
}, [])

const handleSubmit = async (e: React.FormEvent<HTMLFormElement>) => {
Expand Down
13 changes: 9 additions & 4 deletions frontend/src/pages/SignUp.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -145,10 +145,15 @@ const SignUp = () => {
}

const handleRecaptchaVerify = useCallback(async (token: string) => {
const ip = await UserService.getIP()
const status = await UserService.verifyRecaptcha(token, ip)
const valid = status === 200
setRecaptchaError(!valid)
try {
const ip = await UserService.getIP()
const status = await UserService.verifyRecaptcha(token, ip)
const valid = status === 200
setRecaptchaError(!valid)
} catch (err) {
helper.error(err)
setRecaptchaError(true)
}
}, [])

const handleTosChange = (e: React.ChangeEvent<HTMLInputElement>) => {
Expand Down

0 comments on commit b309b2d

Please sign in to comment.