Commit bf010a7455cce14cc91a08a6e54a88f5eab76a18

Authored by ww
1 parent 6bb150f5

perf: token即将过期时提前刷新token

Showing 1 changed file with 1 additions and 1 deletions
... ... @@ -120,7 +120,7 @@ export class VAxios {
120 120 if (userStore && userStore.jwtToken) {
121 121 try {
122 122 const res = jwt_decode(userStore.jwtToken) as JwtModel;
123   - const currentTime = new Date().getTime() / 1000;
  123 + const currentTime = (new Date().getTime() + (config.timeout || 0)) / 1000;
124 124 if (currentTime >= res.exp && this.isNeedTokenURL(config.url)) {
125 125 await this.refreshTokenBeforeReq(userStore.doRefresh);
126 126 }
... ...