Skip to content

Commit c246b47

Browse files
committed
feat: 未登录过时进入首页直接调整登录页
1 parent 8cd6b4a commit c246b47

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/utils/NotifyUtils.tsx

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ const logoutHandler = () => {
1313
cleanCache();
1414
const { pathname } = history.location;
1515
history.replace(`${login_uri}?redirect=${pathname}`);
16+
Token.clean();
17+
User.clean();
1618
logoutModal = undefined;
1719
Modal.destroyAll();
1820
};
@@ -53,8 +55,12 @@ const Notify = {
5355
return;
5456
}
5557

56-
Token.clean();
57-
User.clean();
58+
// 如果没有缓存过token - 未登录过.
59+
if (!Token.get()) {
60+
// 直接跳转到登录页
61+
logoutHandler();
62+
return;
63+
}
5864

5965
if (!logoutModal) {
6066
Modal.destroyAll();

0 commit comments

Comments
 (0)