diff options
| author | it-fixcomart <it@fixcomart.co.id> | 2024-08-26 11:59:57 +0700 |
|---|---|---|
| committer | it-fixcomart <it@fixcomart.co.id> | 2024-08-26 11:59:57 +0700 |
| commit | 54b6b618effc8416027ed884be1d6d37257c26c4 (patch) | |
| tree | ee02fc830ac6eaf4b6652032b33d0c6ecdd25cc8 /src-migrate/modules/register/components/RegistrasiBisnis.tsx | |
| parent | ad3038d8902245ba0ec4122dc9795cda3906ba0e (diff) | |
<iman> update fungsion component
Diffstat (limited to 'src-migrate/modules/register/components/RegistrasiBisnis.tsx')
| -rw-r--r-- | src-migrate/modules/register/components/RegistrasiBisnis.tsx | 59 |
1 files changed, 2 insertions, 57 deletions
diff --git a/src-migrate/modules/register/components/RegistrasiBisnis.tsx b/src-migrate/modules/register/components/RegistrasiBisnis.tsx index c158e2f4..443ff0a0 100644 --- a/src-migrate/modules/register/components/RegistrasiBisnis.tsx +++ b/src-migrate/modules/register/components/RegistrasiBisnis.tsx @@ -14,7 +14,6 @@ import { useMutation } from "react-query"; import { RegisterProps } from "~/types/auth"; import { registerUser } from "~/services/auth"; import router from "next/router"; -import toast from "react-hot-toast"; import { useRouter } from "next/router"; import { UseToastOptions, useToast } from "@chakra-ui/react"; import Link from "next/link"; @@ -22,7 +21,6 @@ import Link from "next/link"; const RegistrasiBisnis = () => { const [isPKP, setIsPKP] = useState(true); const [isTerdaftar, setIsTerdaftar] = useState(false); - const [isIndividuRequired, setIsIndividuRequired] = useState(true); const [isDropIndividu, setIsDropIndividu] = useState(true); const [isBisnisClicked, setisBisnisClicked] = useState(true); const [selectedValue, setSelectedValue] = useState('PKP'); @@ -55,19 +53,16 @@ const RegistrasiBisnis = () => { setSelectedValue(value); if (value === "PKP") { validate(); - setIsIndividuRequired(true); setIsPKP(true); } else { validate(); setIsPKP(false); - setIsIndividuRequired(false); // Hide and make optional the Individu form setIsPKP(false); } }; const handleChangeBisnis = (value: string) => { setSelectedValueBisnis(value); - console.log('value',value) if (value === "true") { validate(); updateForm('is_terdaftar','true') @@ -87,46 +82,6 @@ const RegistrasiBisnis = () => { setisBisnisClicked(!isBisnisClicked) }; - const handleSubmit = async () => { - console.log("form",form) - console.log("form Bisnis",form) - const response = await mutation.mutateAsync(form) - - 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 ( <> @@ -192,19 +147,9 @@ const RegistrasiBisnis = () => { )} </div> </div> + <h1 className=""></h1> - <FormCaptcha /> - <TermCondition /> - <Button - type="submit" - colorScheme="red" - className="w-full mt-2" - size='lg' - onClick={handleSubmit} - // disabled={!isFormValid || !isCheckedTNC || mutation.isLoading || !isValidCaptcha} - > - {mutation.isLoading ? 'Loading...' : 'Daftar'} - </Button> + </> ); }; |
