Skip to content

Commit

Permalink
feat(verification): fixed eslint complaints
Browse files Browse the repository at this point in the history
  • Loading branch information
vgeffer committed Dec 8, 2023
1 parent 871befd commit 34f5e52
Showing 1 changed file with 13 additions and 11 deletions.
24 changes: 13 additions & 11 deletions src/components/VerifyEmail/VerifyEmail.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,34 +2,36 @@ import {useMutation} from '@tanstack/react-query'
import axios from 'axios'
import {useRouter} from 'next/router'
import {FC, useEffect} from 'react'

import {LoginForm} from '../PageLayout/LoginForm/LoginForm'

export const VerifyEmail: FC = () => {
const router = useRouter()
const {verificationKey} = router.query

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

useEffect(() => {
typeof verificationKey === 'string' && verifyEmail(verificationKey)
}, [verificationKey, verifyEmail])




if (isError)
return <>I am a temporary email verification error. Please put me out of my misery.</>

if (isError) return <>I am a temporary email verification error. Please put me out of my misery.</>
else if (isVerified)
return (
<>
<p>Pre dokončenie overenia emailu sa prihláste</p>
<LoginForm closeOverlay={()=>{ router.push("/") }}/>
<LoginForm
closeOverlay={() => {
router.push('/')
}}
/>
</>
)

else
return <>Loading... </>
else return <>Loading... </>
}

0 comments on commit 34f5e52

Please sign in to comment.