From f7701abcbe05510c3672c4768df03fee535956e3 Mon Sep 17 00:00:00 2001
From: "HATEC\\SPVDEV001" <tri.susilo@altama.co.id>
Date: Tue, 30 Jan 2024 09:03:20 +0700
Subject: handling form form

---
 src/lib/form/components/KunjunganSales.jsx | 11 +++++++++++
 1 file changed, 11 insertions(+)

(limited to 'src/lib/form/components/KunjunganSales.jsx')

diff --git a/src/lib/form/components/KunjunganSales.jsx b/src/lib/form/components/KunjunganSales.jsx
index 7470395a..29940edf 100644
--- a/src/lib/form/components/KunjunganSales.jsx
+++ b/src/lib/form/components/KunjunganSales.jsx
@@ -10,6 +10,9 @@ import * as Yup from 'yup'
 import createLeadApi from '../api/createLeadApi'
 import PageContent from '@/lib/content/components/PageContent'
 
+import useAuth from '@/core/hooks/useAuth'
+import { useRouter } from 'next/router'
+
 const KunjunganSales = () => {
   const {
     register,
@@ -23,10 +26,18 @@ const KunjunganSales = () => {
   })
   const [cities, setCities] = useState([])
   const [companyTypes, setCompanyTypes] = useState([])
+  const router = useRouter()
+
+  const auth = useAuth()
+
+  
 
   const recaptchaRef = useRef(null)
 
   useEffect(() => {
+    if(!auth) {
+      router.push('/login')
+    }
     const loadCities = async () => {
       let dataCities = await cityApi()
       dataCities = dataCities.map((obj) => ({ value: obj.name, label: obj.name }))
-- 
cgit v1.2.3

