Skip to content

Commit

Permalink
feat(verification): added loading state to verification
Browse files Browse the repository at this point in the history
  • Loading branch information
vgeffer committed Dec 8, 2023
1 parent 8ea7e78 commit 871befd
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions src/components/VerifyEmail/VerifyEmail.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export const VerifyEmail: FC = () => {
const router = useRouter()
const {verificationKey} = router.query

const {mutate: verifyEmail, isSuccess: isEmailVerified} = useMutation({
const {mutate: verifyEmail, isError: isError, isSuccess: isVerified} = useMutation({

Check failure on line 11 in src/components/VerifyEmail/VerifyEmail.tsx

View workflow job for this annotation

GitHub Actions / branch-test

Replace `mutate:·verifyEmail,·isError:·isError,·isSuccess:·isVerified` with `⏎····mutate:·verifyEmail,⏎····isError:·isError,⏎····isSuccess:·isVerified,⏎··`
mutationFn: (verificationKey: string) => axios.post('/api/user/registration/verify-email', {key: verificationKey}),
})

Expand All @@ -17,13 +17,19 @@ export const VerifyEmail: FC = () => {
}, [verificationKey, verifyEmail])

Check failure on line 17 in src/components/VerifyEmail/VerifyEmail.tsx

View workflow job for this annotation

GitHub Actions / branch-test

Delete `⏎⏎⏎`


if (!isEmailVerified)


if (isError)

Check failure on line 22 in src/components/VerifyEmail/VerifyEmail.tsx

View workflow job for this annotation

GitHub Actions / branch-test

Replace `⏎····return·<>I·am·a·temporary·email·verification·error.·Please·put·me·out·of·my·misery.</>⏎` with `·return·<>I·am·a·temporary·email·verification·error.·Please·put·me·out·of·my·misery.</>`
return <>I am a temporary email verification error. Please put me out of my misery.</>

return (
<>
<p>Pre dokončenie overenia emailu sa prihláste</p>
<LoginForm closeOverlay={()=>{ router.push("/") }}/>
</>
)
else if (isVerified)
return (
<>
<p>Pre dokončenie overenia emailu sa prihláste</p>
<LoginForm closeOverlay={()=>{ router.push("/") }}/>

Check failure on line 29 in src/components/VerifyEmail/VerifyEmail.tsx

View workflow job for this annotation

GitHub Actions / branch-test

Replace `·closeOverlay={()=>{·router.push("/")·}}` with `⏎··········closeOverlay={()·=>·{⏎············router.push('/')⏎··········}}⏎········`
</>
)

Check failure on line 32 in src/components/VerifyEmail/VerifyEmail.tsx

View workflow job for this annotation

GitHub Actions / branch-test

Replace `⏎··else⏎···` with `else`
else
return <>Loading... </>
}

0 comments on commit 871befd

Please sign in to comment.