-
-
Notifications
You must be signed in to change notification settings - Fork 77
Open
Description
i want to use the nookies to set the cookies when the user response is get from server and based on response. and after that i am want to redirect the user to "/dasboard" .
It saves the cookies to the specific path but unable to redirect the user to mentioned route.
here is the code
`
const saveUserDetails = async () => {
// ... your login logic
if (user.data.role === 'USER') {
const expiryTime = new Date(new Date().getTime() + 360 * 60 * 1000);
setCookie('role', user?.data?.role, {
expires: expiryTime,
path: '/dashboard/user',
});
setCookie('user', JSON.stringify(user?.data?.userLogged), {
expires: expiryTime,
path: '/dashboard/user',
});
router.push('/dashboard/user');
SimpleAlert('Success', 'Successfully logged in', 'success');
}
};
`
Metadata
Metadata
Assignees
Labels
No labels