feature 刷新token排除网络异常
This commit is contained in:
parent
ca7f15829f
commit
d22ce844f6
|
|
@ -1,5 +1,5 @@
|
|||
import { Feature } from 'oak-frontend-base/es/types/Feature';
|
||||
import { OakRowInconsistencyException, OakUnloggedInException, } from 'oak-domain/lib/types/Exception';
|
||||
import { OakRowInconsistencyException, OakUnloggedInException, OakNetworkException } from 'oak-domain/lib/types/Exception';
|
||||
import { tokenProjection } from '../types/Projection';
|
||||
import { OakUserInfoLoadingException } from '../types/Exception';
|
||||
import { LOCAL_STORAGE_KEYS } from '../config/constants';
|
||||
|
|
@ -54,8 +54,11 @@ export class Token extends Feature {
|
|||
}
|
||||
}
|
||||
catch (err) {
|
||||
// refresh出了任何错都无视,直接放弃此token
|
||||
// refresh出了任何错都无视(排除网络异常),直接放弃此token
|
||||
console.warn(err);
|
||||
if (err instanceof OakNetworkException) {
|
||||
return
|
||||
}
|
||||
this.tokenValue = undefined;
|
||||
this.removeToken(true);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -57,8 +57,11 @@ class Token extends Feature_1.Feature {
|
|||
}
|
||||
}
|
||||
catch (err) {
|
||||
// refresh出了任何错都无视,直接放弃此token
|
||||
// refresh出了任何错都无视(排除网络异常),直接放弃此token
|
||||
console.warn(err);
|
||||
if (err instanceof Exception_1.OakNetworkException) {
|
||||
return;
|
||||
}
|
||||
this.tokenValue = undefined;
|
||||
this.removeToken(true);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ import {
|
|||
OakRowInconsistencyException,
|
||||
OakUnloggedInException,
|
||||
OakUserUnpermittedException,
|
||||
OakNetworkException,
|
||||
} from 'oak-domain/lib/types/Exception';
|
||||
import { Cache } from 'oak-frontend-base/es/features/cache';
|
||||
import { LocalStorage } from 'oak-frontend-base/es/features/localStorage';
|
||||
|
|
@ -87,8 +88,11 @@ export class Token<
|
|||
await this.storage.save(LOCAL_STORAGE_KEYS.token, result);
|
||||
}
|
||||
} catch (err) {
|
||||
// refresh出了任何错都无视,直接放弃此token
|
||||
// refresh出了任何错都无视(排除网络异常),直接放弃此token
|
||||
console.warn(err);
|
||||
if (err instanceof OakNetworkException) {
|
||||
return;
|
||||
}
|
||||
this.tokenValue = undefined;
|
||||
this.removeToken(true);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue