Add authentication check to auth layout route
This commit is contained in:
@@ -32,6 +32,14 @@ const routes: RouteData[] = [
|
|||||||
{
|
{
|
||||||
path: "",
|
path: "",
|
||||||
component: () => import("./auth/layout.vue"),
|
component: () => import("./auth/layout.vue"),
|
||||||
|
beforeEnter: (to, from, next) => {
|
||||||
|
const auth = useAuthStore();
|
||||||
|
if (auth.user) {
|
||||||
|
next({ name: "overview" });
|
||||||
|
} else {
|
||||||
|
next();
|
||||||
|
}
|
||||||
|
},
|
||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
path: "login",
|
path: "login",
|
||||||
|
|||||||
Reference in New Issue
Block a user