diff --git a/src/components/modules/verify-customer/VerifyCustomerAccount/VerifyCustomerAccount.module.scss b/src/components/modules/verify-customer/VerifyCustomerAccount/VerifyCustomerAccount.module.scss new file mode 100644 index 000000000..c0abfceda --- /dev/null +++ b/src/components/modules/verify-customer/VerifyCustomerAccount/VerifyCustomerAccount.module.scss @@ -0,0 +1,16 @@ +@import "../../../../styles/utilities"; + +.verifyCustomerAccount { + @apply spacing-horizontal; + min-height: 25rem; + margin: 5rem auto 10rem; + display: flex; + justify-content: center; + + .result { + @apply flex flex-col justify-center items-center; + .message { + margin-bottom: 1.6rem; + } + } +} diff --git a/src/components/modules/verify-customer/VerifyCustomerAccount/VerifyCustomerAccount.tsx b/src/components/modules/verify-customer/VerifyCustomerAccount/VerifyCustomerAccount.tsx new file mode 100644 index 000000000..75caecb5b --- /dev/null +++ b/src/components/modules/verify-customer/VerifyCustomerAccount/VerifyCustomerAccount.tsx @@ -0,0 +1,50 @@ +import { useRouter } from 'next/router' +import { useEffect, useState } from 'react' +import { ButtonCommon } from 'src/components/common' +import LoadingCommon from 'src/components/common/LoadingCommon/LoadingCommon' +import { useVerifyCustomer } from 'src/components/hooks' +import { ROUTE } from 'src/utils/constanst.utils' +import s from './VerifyCustomerAccount.module.scss' +import Link from 'next/link' + +export default function VerifyCustomerAccount() { + const router = useRouter() + const [isVerified, setIsVerified] = useState(false) + const { error, loading, verify } = useVerifyCustomer() + + useEffect(() => { + const token = router.query.token + if (token && !isVerified) { + setIsVerified(true) + verify({ token: token.toString() }) + } + }, [router, verify, isVerified]) + + return ( +
+ {loading || !isVerified ? ( +
+ +
+ ) : error ? ( +
+
Error: {error?.message}
+ + + Back to home + + +
+ ) : ( +
+
Congratulation! Verified account successfully
+ + + Back to home + + +
+ )} +
+ ) +}