summaryrefslogtreecommitdiff
path: root/src/lib/form/components/KunjunganService.jsx
diff options
context:
space:
mode:
authortrisusilo48 <tri.susilo@altama.co.id>2024-07-10 15:58:51 +0700
committertrisusilo48 <tri.susilo@altama.co.id>2024-07-10 15:58:51 +0700
commit2e3c726bc8217f3960cfecec44b81303b03de72b (patch)
tree1b85ced7f61f3e4c3f1f27b577b37aa161615065 /src/lib/form/components/KunjunganService.jsx
parent2b3bd9c0a454dbad69ce29cee877bfb1fca5dfa6 (diff)
parenta99bf6480eea556e53b85e6db45f3b8c2361e693 (diff)
Merge branch 'release' into development
# Conflicts: # src/pages/shop/product/variant/[slug].jsx
Diffstat (limited to 'src/lib/form/components/KunjunganService.jsx')
-rw-r--r--src/lib/form/components/KunjunganService.jsx12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/lib/form/components/KunjunganService.jsx b/src/lib/form/components/KunjunganService.jsx
index 1cb0b446..5720d14e 100644
--- a/src/lib/form/components/KunjunganService.jsx
+++ b/src/lib/form/components/KunjunganService.jsx
@@ -8,6 +8,9 @@ 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 CreateKunjunganService = () => {
const {
@@ -22,17 +25,24 @@ const CreateKunjunganService = () => {
})
const [cities, setCities] = useState([])
const [company_unit, setCompany_unit] = useState([])
+
+ const router = useRouter()
+
+ const auth = useAuth()
const recaptchaRef = useRef(null)
useEffect(() => {
+ if(auth == false) {
+ router.push('/login')
+ }
const loadCities = async () => {
let dataCities = await cityApi()
dataCities = dataCities.map((city) => ({ value: city.id, label: city.name }))
setCities(dataCities)
}
loadCities()
- }, [])
+ }, [auth])
const onSubmitHandler = async (values) => {
const recaptchaValue = recaptchaRef.current.getValue()