Added checkbox for accepted terms

This commit is contained in:
Joao Ramos
2024-02-12 21:45:37 +00:00
parent 4802310474
commit 17ec004a59
3 changed files with 44 additions and 3 deletions

View File

@@ -4,9 +4,10 @@ import Input from "@/components/Low/Input";
import { User } from "@/interfaces/user";
import { sendEmailVerification } from "@/utils/email";
import axios from "axios";
import { useEffect, useState } from "react";
import { useState } from "react";
import { toast } from "react-toastify";
import { KeyedMutator } from "swr";
import useAcceptedTerms from "@/hooks/useAcceptedTerms";
interface Props {
queryCode?: string;
@@ -35,6 +36,7 @@ export default function RegisterIndividual({
const [confirmPassword, setConfirmPassword] = useState("");
const [code, setCode] = useState(queryCode || "");
const [hasCode, setHasCode] = useState<boolean>(!!queryCode);
const {acceptedTerms, renderCheckbox} = useAcceptedTerms();
const onSuccess = () =>
toast.success(
@@ -146,7 +148,9 @@ export default function RegisterIndividual({
/>
)}
</div>
<div className="flex w-full flex-col items-start gap-4">
{renderCheckbox()}
</div>
<Button
className="w-full lg:mt-8"
color="purple"
@@ -156,6 +160,7 @@ export default function RegisterIndividual({
!name ||
!password ||
!confirmPassword ||
!acceptedTerms ||
password !== confirmPassword ||
(hasCode ? !code : false)
}