login 功能

This commit is contained in:
simple321vip
2022-04-15 00:08:42 +08:00
parent 18da3c57b7
commit 4caddc06c0
9 changed files with 124 additions and 109 deletions
+8 -2
View File
@@ -29,9 +29,15 @@ if (url != 'http://localhost:3000/' && url.search("blog=") != -1) {
})
}
router.beforeEach((to, from, next) => {
console.log(to.path, from.path)
console.log(from.path, to.path)
const token = getToken()
if (to.path === '/login') {
next()
if (token) {
next('/home')
} else {
next()
}
}