summaryrefslogtreecommitdiff
path: root/src-migrate/modules/register/components/RegistrasiBisnis.tsx
diff options
context:
space:
mode:
authorit-fixcomart <it@fixcomart.co.id>2024-08-24 08:46:44 +0700
committerit-fixcomart <it@fixcomart.co.id>2024-08-24 08:46:44 +0700
commit0bca1bfb2bc7e52a31dde39602dd599d7c640e73 (patch)
tree2859fefbcde9243d394f03929814d7951b41014a /src-migrate/modules/register/components/RegistrasiBisnis.tsx
parentbf33cdda7fb249cdd2473e0d1039704fd2171589 (diff)
<iman> update new register
Diffstat (limited to 'src-migrate/modules/register/components/RegistrasiBisnis.tsx')
-rw-r--r--src-migrate/modules/register/components/RegistrasiBisnis.tsx36
1 files changed, 36 insertions, 0 deletions
diff --git a/src-migrate/modules/register/components/RegistrasiBisnis.tsx b/src-migrate/modules/register/components/RegistrasiBisnis.tsx
index 12ec7ba2..6ace27f9 100644
--- a/src-migrate/modules/register/components/RegistrasiBisnis.tsx
+++ b/src-migrate/modules/register/components/RegistrasiBisnis.tsx
@@ -86,6 +86,42 @@ const RegistrasiBisnis = () => {
const handleSubmit = async () => {
console.log("form",form)
console.log("form Bisnis",formBisnis)
+ const response = await mutation.mutateAsync(formBisnis)
+
+ console.log("response",response)
+
+ if (response?.register === true) {
+ const urlParams = new URLSearchParams({
+ activation: 'otp',
+ email: form.email,
+ redirect: (router.query?.next || '/') as string
+ })
+ router.push(`${router.route}?${urlParams}`)
+ }
+
+ const toastProps: UseToastOptions = {
+ duration: 5000,
+ isClosable: true
+ }
+
+ switch (response?.reason) {
+ case 'EMAIL_USED':
+ toast({
+ ...toastProps,
+ title: 'Email sudah digunakan',
+ status: 'warning'
+ })
+ break;
+ case 'NOT_ACTIVE':
+ const activationUrl = `${router.route}?activation=email`
+ toast({
+ ...toastProps,
+ title: 'Akun belum aktif',
+ description: <>Akun sudah terdaftar namun belum aktif. <Link href={activationUrl} className="underline">Klik untuk aktivasi akun</Link></>,
+ status: 'warning'
+ })
+ break
+ }
};
return (
<>