update: route

This commit is contained in:
2025-09-26 11:07:03 +07:00
parent 27b060845b
commit c64b7b3490
11 changed files with 868 additions and 970 deletions

View File

@@ -1,7 +1,12 @@
const handleLogOut = () => {
localStorage.removeItem('Auth');
localStorage.removeItem('session');
const handleLogOut = (navigate) => {
localStorage.removeItem('Auth');
localStorage.removeItem('session');
if (navigate) {
navigate('/signin', { replace: true });
} else {
window.location.replace('/signin');
}
}
};
export default handleLogOut;

View File

@@ -8,18 +8,14 @@ const handleSignIn = async (values) => {
// return false
if (response?.status == 200) {
/* you can change this according to your authentication protocol */
let token = JSON.stringify(response.data?.token);
let role = JSON.stringify(response.data?.user?.role_id);
localStorage.setItem('token', token);
response.data.auth = true;
localStorage.setItem('session', encryptData(response?.data));
if (role === `${import.meta.env.VITE_ROLE_VENDOR}`) {
window.location.replace('/dashboard/home-vendor');
} else {
window.location.replace('/dashboard/home');
}
// langsung redirect ke dashboard utama
window.location.replace('/dashboard/home');
} else {
NotifAlert({
icon: 'error',