diff --git a/src/module/auth/varification/view/view_verification.tsx b/src/module/auth/varification/view/view_verification.tsx index 3250127..d03f59a 100644 --- a/src/module/auth/varification/view/view_verification.tsx +++ b/src/module/auth/varification/view/view_verification.tsx @@ -38,8 +38,7 @@ export default function ViewVerification({ phone, otp, user }: IVerification) { toast.success(setCookies.message) if (setCookies.pertamaLogin == true) return router.replace('/welcome') - console.log(setCookies.pertamaLogin) - return router.replace('/home') + return window.location.href = '/home'; } else { toast.error(setCookies.message) } diff --git a/src/module/user/profile/view/view_profile.tsx b/src/module/user/profile/view/view_profile.tsx index 50000b1..5b8e22b 100644 --- a/src/module/user/profile/view/view_profile.tsx +++ b/src/module/user/profile/view/view_profile.tsx @@ -16,13 +16,18 @@ import { useState } from "react"; export default function ViewProfile() { const [openModal, setOpenModal] = useState(false); - async function onLogout() { + async function onLogout(val: boolean) { try { - await fetch('/api/auth/logout', { - method: 'DELETE', - }); - toast.success('Logout Success') - window.location.href = '/'; + if (val) { + await fetch('/api/auth/logout', { + method: 'DELETE', + }); + toast.success('Logout Success') + window.location.href = '/'; + } + + setOpenModal(false) + } catch (error) { console.error(error); } @@ -33,9 +38,9 @@ export default function ViewProfile() { - { setOpenModal(true) }} variant="light" bg={WARNA.bgIcon} size="lg" radius="lg" aria-label="Info"> - - + { setOpenModal(true) }} variant="light" bg={WARNA.bgIcon} size="lg" radius="lg" aria-label="Info"> + + setOpenModal(false)} description="Apakah Anda yakin ingin Keluar?" - onYes={() => onLogout()} /> + onYes={(val) => onLogout(val)} /> ) } \ No newline at end of file