How to redirect from sign-in to dashboard if user logged in??
Hi Uzzal,
It should be done by default, all users will be redirected to the dashboard page after successful login.
You can change the default page in file src/views/crafted/authentication/basic-flow/SignIn.vue.
router.push({ name: "dashboard" });
I understand this. My question was:
If the user is already logged-in then how can I redirect user to "dashboard" if he tries to visit the "sign-in" page?
In current scenario:
If the user is logged-in, still able to visit "sign-in" page and type login credentials.
Hi,
You can implement this in file src/components/page-layouts/Auth.vue
Inside the mounted function check if user is authenticated and if he is already authenticated you can redirect the user to a dashboard page.
onMounted(() => {
if (store.getters.isUserAuthenticated) {
router.push({ name: "dashboard" });
}
});
Isn’t it default behavior?
Yes, it is default behavior for all Vue demos.