增加 removeToken清除本地token
This commit is contained in:
parent
caa92e8106
commit
be6a5d702d
|
|
@ -17,6 +17,7 @@ export declare class Token<ED extends EntityDict, Cxt extends BackendRuntimeCont
|
|||
loginWechatMp(): Promise<void>;
|
||||
syncUserInfoWechatMp(): Promise<void>;
|
||||
logout(): Promise<void>;
|
||||
removeToken(): void;
|
||||
getTokenValue(): string | undefined;
|
||||
getToken(allowUnloggedIn?: boolean, context?: FrontCxt): Partial<ED["token"]["Schema"]> | undefined;
|
||||
getUserId(allowUnloggedIn?: boolean, context?: FrontCxt): NonNullable<ED["token"]["Schema"]["userId"]> | undefined;
|
||||
|
|
|
|||
|
|
@ -138,14 +138,21 @@ var Token = /** @class */ (function (_super) {
|
|||
Token.prototype.logout = function () {
|
||||
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
||||
return tslib_1.__generator(this, function (_a) {
|
||||
// await this.cache.exec('logout', {});
|
||||
this.tokenValue = undefined;
|
||||
this.storage.remove('token:token');
|
||||
this.publish();
|
||||
return [2 /*return*/];
|
||||
switch (_a.label) {
|
||||
case 0: return [4 /*yield*/, this.cache.exec('logout', {})];
|
||||
case 1:
|
||||
_a.sent();
|
||||
this.removeToken();
|
||||
return [2 /*return*/];
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
||||
Token.prototype.removeToken = function () {
|
||||
this.tokenValue = undefined;
|
||||
this.storage.remove('token:token');
|
||||
this.publish();
|
||||
};
|
||||
Token.prototype.getTokenValue = function () {
|
||||
return this.tokenValue;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -103,7 +103,11 @@ export class Token<
|
|||
}
|
||||
|
||||
async logout() {
|
||||
// await this.cache.exec('logout', {});
|
||||
await this.cache.exec('logout', {});
|
||||
this.removeToken();
|
||||
}
|
||||
|
||||
removeToken() {
|
||||
this.tokenValue = undefined;
|
||||
this.storage.remove('token:token');
|
||||
this.publish();
|
||||
|
|
|
|||
|
|
@ -8,14 +8,12 @@ import { isWeiXin } from 'oak-frontend-base/lib/utils/utils';
|
|||
import { WebComponentProps } from 'oak-frontend-base';
|
||||
import { EntityDict } from '../../../general-app-domain';
|
||||
|
||||
export default function render(
|
||||
export default function Render(
|
||||
props: WebComponentProps<
|
||||
EntityDict,
|
||||
'userEntityGrant',
|
||||
true,
|
||||
{
|
||||
oakLoading: boolean;
|
||||
oakExecuting: boolean;
|
||||
type: 'grant';
|
||||
expired: boolean;
|
||||
relation: boolean;
|
||||
|
|
|
|||
Loading…
Reference in New Issue