Skip to content

Commit

Permalink
fix(portal): 修复登录页跳转无限循环问题
Browse files Browse the repository at this point in the history
  • Loading branch information
moonrailgun committed Jun 24, 2020
1 parent 402fa32 commit 2838e68
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/portal/routes/sso/Login.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class Login extends React.Component {
if (window.localStorage.getItem('jwt')) {
// 处理登录事件
console.log('正在尝试登录...');
checkToken().then(() => {
checkToken(false).then(() => {
// 当前Token有效
this.gotoNextUrl();
});
Expand Down
1 change: 1 addition & 0 deletions src/portal/utils/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ export const getToken = (): string => {
* 发送一个校验token的请求到服务端
* 如果校验不通过会由request的拦截器自动跳转到登录页
* 该检查一般用于表单填写页面防止填了一堆数据后提交失败跳转到登录页的挫败感
* @param 是否自动跳转。如果为登录页则此值应该为false
*/
export const checkToken = async (autoNav = true): Promise<void> => {
try {
Expand Down

0 comments on commit 2838e68

Please sign in to comment.