diff --git a/src/router/index.ts b/src/router/index.ts index 6928d9a..a5fbb3f 100644 --- a/src/router/index.ts +++ b/src/router/index.ts @@ -1,6 +1,6 @@ import vuex from '@/store' -import type {MyRouteMeta, MyRouteRecordRaw} from '@/types/router' -import {createRouter, createWebHistory} from 'vue-router' +import type { MyRouteMeta, MyRouteRecordRaw } from '@/types/router' +import { createRouter, createWebHistory } from 'vue-router' import auth from './routers/auth' import user from './routers/user' @@ -53,9 +53,9 @@ router.beforeEach((to, from, next) => { const isAuthenticated: string = vuex.getters.isLogin if (to.name !== 'AuthLogin' && to.meta.requiresAuth && !isAuthenticated) { - next({name: 'AuthLogin', query: {to: to.path}}) + next({ name: 'AuthLogin', query: { to: to.path }}) } else if (isAuthenticated && (to.name == 'AuthLogin' || to.name == 'AuthRegister')) { - next({name: 'Home'}) + next({ name: 'Home' }) } else { next() }