From f7701abcbe05510c3672c4768df03fee535956e3 Mon Sep 17 00:00:00 2001 From: "HATEC\\SPVDEV001" Date: Tue, 30 Jan 2024 09:03:20 +0700 Subject: handling form form --- src/lib/form/components/PembayaranTempo.jsx | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'src/lib/form/components/PembayaranTempo.jsx') diff --git a/src/lib/form/components/PembayaranTempo.jsx b/src/lib/form/components/PembayaranTempo.jsx index 8c624fe2..73ceee49 100644 --- a/src/lib/form/components/PembayaranTempo.jsx +++ b/src/lib/form/components/PembayaranTempo.jsx @@ -1,12 +1,15 @@ import getFileBase64 from '@/core/utils/getFileBase64' import { yupResolver } from '@hookform/resolvers/yup' -import React, { useRef } from 'react' +import React, { useEffect, useRef } from 'react' import ReCAPTCHA from 'react-google-recaptcha' import { useForm } from 'react-hook-form' import { toast } from 'react-hot-toast' import * as Yup from 'yup' import createLeadApi from '../api/createLeadApi' import PageContent from '@/lib/content/components/PageContent' +import { useRouter } from 'next/router' + +import useAuth from '@/core/hooks/useAuth' const PembayaranTempo = () => { @@ -21,6 +24,15 @@ const PembayaranTempo = () => { }) const recaptchaRef = useRef(null) + const router = useRouter() + + const auth = useAuth() + + useEffect(() => { + if(!auth) { + router.push('/login') + } + },[]) const onSubmitHandler = async (values) => { const recaptchaValue = recaptchaRef.current.getValue() -- cgit v1.2.3 From 2e38ec15d42201c26c48f9bcf856750204db0582 Mon Sep 17 00:00:00 2001 From: "HATEC\\SPVDEV001" Date: Fri, 9 Feb 2024 10:19:28 +0700 Subject: fixing error form form sales --- src/lib/form/components/PembayaranTempo.jsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/lib/form/components/PembayaranTempo.jsx') diff --git a/src/lib/form/components/PembayaranTempo.jsx b/src/lib/form/components/PembayaranTempo.jsx index 73ceee49..9591a0b0 100644 --- a/src/lib/form/components/PembayaranTempo.jsx +++ b/src/lib/form/components/PembayaranTempo.jsx @@ -29,10 +29,10 @@ const PembayaranTempo = () => { const auth = useAuth() useEffect(() => { - if(!auth) { + if(auth) { router.push('/login') } - },[]) + },[auth]) const onSubmitHandler = async (values) => { const recaptchaValue = recaptchaRef.current.getValue() -- cgit v1.2.3 From 34ee25921623818ba7b03b8542d351fe51bc8076 Mon Sep 17 00:00:00 2001 From: "HATEC\\SPVDEV001" Date: Fri, 9 Feb 2024 10:28:39 +0700 Subject: if auth false di pembayaran tempo --- src/lib/form/components/PembayaranTempo.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/lib/form/components/PembayaranTempo.jsx') diff --git a/src/lib/form/components/PembayaranTempo.jsx b/src/lib/form/components/PembayaranTempo.jsx index 9591a0b0..fc4d248a 100644 --- a/src/lib/form/components/PembayaranTempo.jsx +++ b/src/lib/form/components/PembayaranTempo.jsx @@ -29,7 +29,7 @@ const PembayaranTempo = () => { const auth = useAuth() useEffect(() => { - if(auth) { + if(auth == false) { router.push('/login') } },[auth]) -- cgit v1.2.3