Feature/task1.0.0 See merge request yanxuan-frontend/shop-pc!75merge-requests/77/merge
commit
0ed9fc9885
@ -0,0 +1,10 @@
|
||||
export default function ({ app, route, redirect }) {
|
||||
if (!app.store.state.token) {
|
||||
// 未登录直接打开需要登录的页面,跳转首页
|
||||
const needLoginPage = [/\/account/, /\/cart/];
|
||||
const result = needLoginPage.some((item) => item.test(route.path));
|
||||
if (result) {
|
||||
redirect("/");
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in new issue