Skip to content

Commit

Permalink
用户登录 - 判断用户登录状态
Browse files Browse the repository at this point in the history
  • Loading branch information
ppambler committed Dec 28, 2021
1 parent 5cc2bb8 commit 3891588
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions project/imooc-blog/modules/user.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,5 +98,13 @@ export default {
this.commit("user/removeToken");
this.commit("user/removeUserInfo");
},
/**
* 进行登录判定
*/
isLogin(context) {
if (context.state.token) return true;
// TODO: 如果用户未登录,则引导用户进入登录页面
return false;
},
},
};

0 comments on commit 3891588

Please sign in to comment.