Skip to content

Next router.Push("/dashboard") is not working with nested path instead of root "/" #573

@ABIDULLAH786

Description

@ABIDULLAH786

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

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions