diff --git a/src/components/Navbar.tsx b/src/components/Navbar.tsx index ce17f6b8..7627e53a 100644 --- a/src/components/Navbar.tsx +++ b/src/components/Navbar.tsx @@ -26,13 +26,17 @@ const Navbar = ({ toggleSidebar }: NavbarProps) => { const logoutClickHandler = async () => { const logoutRes = await AuthApi.logout(); - if (isResponseError(logoutRes)) { toast.error('Gagal logout! Coba lagi!'); return; } setUser(undefined); + const redirect = (logoutRes as { redirect?: string })?.redirect; + if (redirect) { + window.location.href = redirect; + return; + } router.replace(process.env.NEXT_PUBLIC_SSO_LOGIN_URL as string); };