feat: 去掉路由前置钩子内未登录跳转页面逻辑

merge-requests/72/head
xiaoguang 2 years ago
parent 9da1383799
commit e97096ffbc

@ -1,21 +1,13 @@
export default ({ app }) => {
app.router.beforeEach((to, from, next) => {
// const { token, userInfo } = app.store.state;
// if (token) {
// if (Object.keys(userInfo).length === 0) {
// app.store.dispatch("getUserInfo");
// }
// next();
// return;
// }
// // 未登录打开需要登录的页面,跳首页
// const needLoginPage = [/\/account/, /\/cart/];
// const result = needLoginPage.some((item) => item.test(to.path));
// if (result) {
// next("/");
// return;
// }
const { token, userInfo } = app.store.state;
if (token) {
if (Object.keys(userInfo).length === 0) {
app.store.dispatch("getUserInfo");
}
next();
return;
}
next();
});
};

Loading…
Cancel
Save