Browse Source

fix:not navigate to login when bad token

dev
powersir 1 year ago
parent
commit
9adca19da9
1 changed files with 11 additions and 8 deletions
  1. +11
    -8
      src/request/index.ts

+ 11
- 8
src/request/index.ts View File

@@ -114,19 +114,22 @@ class Request {
this.toLoginPage(); this.toLoginPage();
} }


const [error, {data}] = await loginService.rerefshToken(refreshToken);
const [error, {code, data, msg}] = await loginService.rerefshToken(refreshToken);


if (error) {
if (error || code !== 0) {
this.toLoginPage(); this.toLoginPage();
useGlobalStore.setState({
refreshToken: '',
token: '',
});
} else {
useGlobalStore.setState({
refreshToken: data.refreshToken,
token: data.accessToken,
});
} }


useGlobalStore.setState({
refreshToken: data.refreshToken,
token: data.accessToken,
});

this.refreshTokenFlag = false; this.refreshTokenFlag = false;

this.requestByQueue(); this.requestByQueue();
} }




Loading…
Cancel
Save