feat: 登录接口联调
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import router from './router'
|
||||
import { isPathMatch } from '@utils/validate'
|
||||
import { getToken } from '@utils/auth'
|
||||
import { Session } from '@renderer/utils/storage'
|
||||
|
||||
// 白名单
|
||||
const whiteList = ['/login', '/register']
|
||||
@@ -8,7 +8,7 @@ const whiteList = ['/login', '/register']
|
||||
const isWhiteList = (path: string) => whiteList.some(pattern => isPathMatch(pattern, path))
|
||||
|
||||
router.beforeEach((to: any, _from: any, next: any) => {
|
||||
if(getToken()) {
|
||||
if(Session.getToken()) {
|
||||
// has token
|
||||
if (to.path === '/login') {
|
||||
next({path: '/home'})
|
||||
|
||||
Reference in New Issue
Block a user