全局token的判断和application的数据完整
This commit is contained in:
parent
c949eaa1b7
commit
966396387c
|
|
@ -1,4 +1,3 @@
|
|||
/// <reference types="react" />
|
||||
import './index.less';
|
||||
declare const Empty: () => JSX.Element;
|
||||
export default Empty;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
/// <reference types="react" />
|
||||
import './index.less';
|
||||
declare const Empty: () => JSX.Element;
|
||||
export default Empty;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
/// <reference types="react" />
|
||||
import './index.less';
|
||||
interface QrCodeProps {
|
||||
id?: string;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
/// <reference types="react" />
|
||||
import { Config } from '../../../../types/Config';
|
||||
export default function Account(props: {
|
||||
account: Required<Config>['Account'];
|
||||
|
|
|
|||
|
|
@ -1,2 +1 @@
|
|||
/// <reference types="react" />
|
||||
export default function render(this: any): JSX.Element;
|
||||
|
|
|
|||
|
|
@ -1,2 +1 @@
|
|||
/// <reference types="react" />
|
||||
export default function render(): JSX.Element;
|
||||
|
|
|
|||
|
|
@ -1,2 +1 @@
|
|||
/// <reference types="react" />
|
||||
export default function render(this: any): JSX.Element;
|
||||
|
|
|
|||
|
|
@ -1,2 +1 @@
|
|||
/// <reference types="react" />
|
||||
export default function render(this: any): JSX.Element;
|
||||
|
|
|
|||
|
|
@ -35,6 +35,11 @@ var BackendRuntimeContext = /** @class */ (function (_super) {
|
|||
id: 1,
|
||||
name: 1,
|
||||
config: 1,
|
||||
platformId: 1,
|
||||
platform: {
|
||||
id: 1,
|
||||
config: 1,
|
||||
},
|
||||
},
|
||||
},
|
||||
filter: {
|
||||
|
|
|
|||
|
|
@ -26,6 +26,11 @@ export declare class FrontendRuntimeContext<ED extends EntityDict, Cxt extends R
|
|||
id: 1;
|
||||
name: 1;
|
||||
config: 1;
|
||||
platformId: 1;
|
||||
platform: {
|
||||
id: 1;
|
||||
config: 1;
|
||||
};
|
||||
};
|
||||
}[T] extends 1 | undefined ? ED["application"]["Schema"][T] : {
|
||||
id: 1;
|
||||
|
|
@ -37,6 +42,11 @@ export declare class FrontendRuntimeContext<ED extends EntityDict, Cxt extends R
|
|||
id: 1;
|
||||
name: 1;
|
||||
config: 1;
|
||||
platformId: 1;
|
||||
platform: {
|
||||
id: 1;
|
||||
config: 1;
|
||||
};
|
||||
};
|
||||
}[T] extends import("oak-domain/lib/types").OtmSubProjection ? never[] | import("oak-domain/lib/types").SelectRowShape<Required<ED["application"]["Schema"]>[T][0], {
|
||||
id: 1;
|
||||
|
|
@ -48,6 +58,11 @@ export declare class FrontendRuntimeContext<ED extends EntityDict, Cxt extends R
|
|||
id: 1;
|
||||
name: 1;
|
||||
config: 1;
|
||||
platformId: 1;
|
||||
platform: {
|
||||
id: 1;
|
||||
config: 1;
|
||||
};
|
||||
};
|
||||
}[T]["data"]>[] : T extends import("oak-domain/lib/types").OptionalKeys<ED["application"]["Schema"]> ? import("oak-domain/lib/types").SelectRowShape<NonNullable<Required<ED["application"]["Schema"]>[T]>, {
|
||||
id: 1;
|
||||
|
|
@ -59,6 +74,11 @@ export declare class FrontendRuntimeContext<ED extends EntityDict, Cxt extends R
|
|||
id: 1;
|
||||
name: 1;
|
||||
config: 1;
|
||||
platformId: 1;
|
||||
platform: {
|
||||
id: 1;
|
||||
config: 1;
|
||||
};
|
||||
};
|
||||
}[T]> | null : import("oak-domain/lib/types").SelectRowShape<NonNullable<Required<ED["application"]["Schema"]>[T]>, {
|
||||
id: 1;
|
||||
|
|
@ -70,6 +90,11 @@ export declare class FrontendRuntimeContext<ED extends EntityDict, Cxt extends R
|
|||
id: 1;
|
||||
name: 1;
|
||||
config: 1;
|
||||
platformId: 1;
|
||||
platform: {
|
||||
id: 1;
|
||||
config: 1;
|
||||
};
|
||||
};
|
||||
}[T]> : never : never : never) | undefined>;
|
||||
getApplication(): Promise<import("oak-domain/lib/types").SelectRowShape<ED["application"]["Schema"], {
|
||||
|
|
@ -82,10 +107,15 @@ export declare class FrontendRuntimeContext<ED extends EntityDict, Cxt extends R
|
|||
id: 1;
|
||||
name: 1;
|
||||
config: 1;
|
||||
platformId: 1;
|
||||
platform: {
|
||||
id: 1;
|
||||
config: 1;
|
||||
};
|
||||
};
|
||||
}> | undefined>;
|
||||
getTokenValue(): Promise<string | undefined>;
|
||||
getToken(): Promise<import("oak-domain/lib/types").SelectRowShape<ED["token"]["Schema"], {
|
||||
getToken(allowUnloggedIn?: boolean): Promise<import("oak-domain/lib/types").SelectRowShape<ED["token"]["Schema"], {
|
||||
id: 1;
|
||||
userId: 1;
|
||||
user: {
|
||||
|
|
@ -140,7 +170,7 @@ export declare class FrontendRuntimeContext<ED extends EntityDict, Cxt extends R
|
|||
};
|
||||
playerId: 1;
|
||||
}> | undefined>;
|
||||
getCurrentUserId(): Promise<string | undefined>;
|
||||
getCurrentUserId(allowUnloggedIn?: boolean): Promise<string | undefined>;
|
||||
toString(): Promise<string>;
|
||||
isRoot(): Promise<boolean>;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ var FrontendRuntimeContext = /** @class */ (function (_super) {
|
|||
});
|
||||
});
|
||||
};
|
||||
FrontendRuntimeContext.prototype.getToken = function () {
|
||||
FrontendRuntimeContext.prototype.getToken = function (allowUnloggedIn) {
|
||||
var _a;
|
||||
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
||||
return tslib_1.__generator(this, function (_b) {
|
||||
|
|
@ -57,7 +57,7 @@ var FrontendRuntimeContext = /** @class */ (function (_super) {
|
|||
});
|
||||
});
|
||||
};
|
||||
FrontendRuntimeContext.prototype.getCurrentUserId = function () {
|
||||
FrontendRuntimeContext.prototype.getCurrentUserId = function (allowUnloggedIn) {
|
||||
var _a;
|
||||
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
||||
return tslib_1.__generator(this, function (_b) {
|
||||
|
|
|
|||
|
|
@ -11,6 +11,11 @@ export declare type GetApplicationShape = {
|
|||
id: 1;
|
||||
name: 1;
|
||||
config: 1;
|
||||
platformId: 1;
|
||||
platform: {
|
||||
id: 1;
|
||||
config: 1;
|
||||
};
|
||||
};
|
||||
};
|
||||
export declare type GetTokeShape = {
|
||||
|
|
|
|||
|
|
@ -28,6 +28,11 @@ export declare class Application<ED extends EntityDict, Cxt extends RuntimeConte
|
|||
id: 1;
|
||||
name: 1;
|
||||
config: 1;
|
||||
platformId: 1;
|
||||
platform: {
|
||||
id: 1;
|
||||
config: 1;
|
||||
};
|
||||
};
|
||||
}>>;
|
||||
getApplicationId(noWait?: true): Promise<string>;
|
||||
|
|
|
|||
|
|
@ -15,6 +15,11 @@ var projection = {
|
|||
id: 1,
|
||||
name: 1,
|
||||
config: 1,
|
||||
platformId: 1,
|
||||
platform: {
|
||||
id: 1,
|
||||
config: 1,
|
||||
},
|
||||
}
|
||||
};
|
||||
var Application = /** @class */ (function (_super) {
|
||||
|
|
|
|||
|
|
@ -77,8 +77,8 @@ export declare class Token<ED extends EntityDict, Cxt extends RuntimeContext<ED>
|
|||
syncUserInfoWechatMp(): Promise<void>;
|
||||
logout(): Promise<void>;
|
||||
getTokenValue(noWait?: true): Promise<string | undefined>;
|
||||
getToken(): Promise<SelectRowShape<ED["token"]["Schema"], TokenProjection>>;
|
||||
getUserId(): Promise<string | undefined>;
|
||||
getToken(allowUnloggedIn?: boolean): Promise<SelectRowShape<ED["token"]["Schema"], TokenProjection> | undefined>;
|
||||
getUserId(allowUnloggedIn?: boolean): Promise<string | undefined>;
|
||||
getUserInfo(): Promise<("user" extends infer T ? T extends "user" ? T extends keyof ED["token"]["Schema"] ? TokenProjection[T] extends 1 | undefined ? ED["token"]["Schema"][T] : TokenProjection[T] extends import("oak-domain/lib/types").OtmSubProjection ? never[] | SelectRowShape<Required<ED["token"]["Schema"]>[T][0], TokenProjection[T]["data"]>[] : T extends import("oak-domain/lib/types").OptionalKeys<ED["token"]["Schema"]> ? SelectRowShape<NonNullable<Required<ED["token"]["Schema"]>[T]>, TokenProjection[T]> | null : SelectRowShape<NonNullable<Required<ED["token"]["Schema"]>[T]>, TokenProjection[T]> : never : never : never) | SelectRowShape<ED["user"]["Schema"], ED["user"]["Selection"]["data"]> | undefined>;
|
||||
isRoot(): Promise<boolean>;
|
||||
sendCaptcha(mobile: string): Promise<string>;
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ exports.Token = void 0;
|
|||
var tslib_1 = require("tslib");
|
||||
var Feature_1 = require("oak-frontend-base/lib/types/Feature");
|
||||
var concurrent_1 = require("oak-domain/lib/utils/concurrent");
|
||||
var Exception_1 = require("oak-domain/lib/types/Exception");
|
||||
var env_1 = require("../utils/env");
|
||||
var userProjection = {
|
||||
id: 1,
|
||||
|
|
@ -266,7 +267,7 @@ var Token = /** @class */ (function (_super) {
|
|||
});
|
||||
});
|
||||
};
|
||||
Token.prototype.getToken = function () {
|
||||
Token.prototype.getToken = function (allowUnloggedIn) {
|
||||
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
||||
return tslib_1.__generator(this, function (_a) {
|
||||
switch (_a.label) {
|
||||
|
|
@ -279,17 +280,21 @@ var Token = /** @class */ (function (_super) {
|
|||
case 1:
|
||||
_a.sent();
|
||||
_a.label = 2;
|
||||
case 2: return [2 /*return*/, this.token];
|
||||
case 2:
|
||||
if (allowUnloggedIn || this.token) {
|
||||
return [2 /*return*/, this.token];
|
||||
}
|
||||
throw new Exception_1.OakUnloggedInException();
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
||||
Token.prototype.getUserId = function () {
|
||||
Token.prototype.getUserId = function (allowUnloggedIn) {
|
||||
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
||||
var token;
|
||||
return tslib_1.__generator(this, function (_a) {
|
||||
switch (_a.label) {
|
||||
case 0: return [4 /*yield*/, this.getToken()];
|
||||
case 0: return [4 /*yield*/, this.getToken(allowUnloggedIn)];
|
||||
case 1:
|
||||
token = _a.sent();
|
||||
return [2 /*return*/, token === null || token === void 0 ? void 0 : token.userId];
|
||||
|
|
|
|||
|
|
@ -1,2 +1 @@
|
|||
/// <reference types="react" />
|
||||
export default function render(this: any): JSX.Element;
|
||||
|
|
|
|||
|
|
@ -1,2 +1 @@
|
|||
/// <reference types="react" />
|
||||
export default function render(this: any): JSX.Element;
|
||||
|
|
|
|||
|
|
@ -1,2 +1 @@
|
|||
/// <reference types="react" />
|
||||
export default function render(this: any): JSX.Element;
|
||||
|
|
|
|||
|
|
@ -1,2 +1 @@
|
|||
/// <reference types="react" />
|
||||
export default function render(this: any): JSX.Element;
|
||||
|
|
|
|||
|
|
@ -1,2 +1 @@
|
|||
/// <reference types="react" />
|
||||
export default function render(this: any): JSX.Element;
|
||||
|
|
|
|||
|
|
@ -1,3 +1,2 @@
|
|||
/// <reference types="react" />
|
||||
import '@wangeditor/editor/dist/css/style.css';
|
||||
export default function render(this: any): JSX.Element;
|
||||
|
|
|
|||
|
|
@ -1,2 +1 @@
|
|||
/// <reference types="react" />
|
||||
export default function render(this: any): JSX.Element;
|
||||
|
|
|
|||
|
|
@ -1,2 +1 @@
|
|||
/// <reference types="react" />
|
||||
export default function render(this: any): JSX.Element;
|
||||
|
|
|
|||
|
|
@ -1,2 +1 @@
|
|||
/// <reference types="react" />
|
||||
export default function render(this: any): JSX.Element;
|
||||
|
|
|
|||
|
|
@ -1,2 +1 @@
|
|||
/// <reference types="react" />
|
||||
export default function render(this: any): JSX.Element;
|
||||
|
|
|
|||
|
|
@ -1,2 +1 @@
|
|||
/// <reference types="react" />
|
||||
export default function render(this: any): JSX.Element;
|
||||
|
|
|
|||
|
|
@ -1,2 +1 @@
|
|||
/// <reference types="react" />
|
||||
export default function render(this: any): JSX.Element;
|
||||
|
|
|
|||
|
|
@ -1,2 +1 @@
|
|||
/// <reference types="react" />
|
||||
export default function render(this: any): JSX.Element;
|
||||
|
|
|
|||
|
|
@ -1,2 +1 @@
|
|||
/// <reference types="react" />
|
||||
export default function render(this: any): JSX.Element;
|
||||
|
|
|
|||
|
|
@ -1,2 +1 @@
|
|||
/// <reference types="react" />
|
||||
export default function render(this: any): JSX.Element;
|
||||
|
|
|
|||
|
|
@ -1,2 +1 @@
|
|||
/// <reference types="react" />
|
||||
export default function render(this: any): JSX.Element;
|
||||
|
|
|
|||
|
|
@ -1,2 +1 @@
|
|||
/// <reference types="react" />
|
||||
export default function render(this: any): JSX.Element;
|
||||
|
|
|
|||
|
|
@ -1,2 +1 @@
|
|||
/// <reference types="react" />
|
||||
export default function render(this: any): JSX.Element;
|
||||
|
|
|
|||
|
|
@ -1,2 +1 @@
|
|||
/// <reference types="react" />
|
||||
export default function render(): JSX.Element;
|
||||
|
|
|
|||
|
|
@ -1,2 +1 @@
|
|||
/// <reference types="react" />
|
||||
export default function render(): JSX.Element;
|
||||
|
|
|
|||
|
|
@ -1,2 +1 @@
|
|||
/// <reference types="react" />
|
||||
export default function render(): JSX.Element;
|
||||
|
|
|
|||
|
|
@ -1,2 +1 @@
|
|||
/// <reference types="react" />
|
||||
export default function render(this: any): JSX.Element;
|
||||
|
|
|
|||
|
|
@ -1,2 +1 @@
|
|||
/// <reference types="react" />
|
||||
export default function render(this: any): JSX.Element;
|
||||
|
|
|
|||
|
|
@ -1,2 +1 @@
|
|||
/// <reference types="react" />
|
||||
export default function render(this: any): JSX.Element;
|
||||
|
|
|
|||
|
|
@ -0,0 +1,25 @@
|
|||
/** index.wxss **/
|
||||
@import "../../../config/styles/mp/index.less";
|
||||
@import "../../../config/styles/mp/mixins.less";
|
||||
|
||||
page {
|
||||
height: 100%;
|
||||
background-color: @bg-color-fade;
|
||||
}
|
||||
|
||||
.container {
|
||||
height: 100%;
|
||||
display: flex;
|
||||
flex: 1;
|
||||
flex-direction: column;
|
||||
box-sizing: border-box;
|
||||
align-items: stretch;
|
||||
padding: 0;
|
||||
.safe-area-inset-bottom();
|
||||
}
|
||||
|
||||
.col {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
background-color: #fff;
|
||||
}
|
||||
|
|
@ -1,2 +1 @@
|
|||
/// <reference types="react" />
|
||||
export default function render(this: any): JSX.Element;
|
||||
|
|
|
|||
|
|
@ -1,2 +1 @@
|
|||
/// <reference types="react" />
|
||||
export default function render(this: any): JSX.Element;
|
||||
|
|
|
|||
|
|
@ -0,0 +1,9 @@
|
|||
|
||||
|
||||
.container {
|
||||
height: 100vh;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: 'center';
|
||||
align-items: 'center';
|
||||
}
|
||||
|
|
@ -1,2 +1 @@
|
|||
/// <reference types="react" />
|
||||
export default function render(this: any): JSX.Element;
|
||||
|
|
|
|||
|
|
@ -1,2 +1 @@
|
|||
/// <reference types="react" />
|
||||
export default function render(this: any): JSX.Element;
|
||||
|
|
|
|||
|
|
@ -1,2 +1 @@
|
|||
/// <reference types="react" />
|
||||
export default function render(this: any): JSX.Element;
|
||||
|
|
|
|||
|
|
@ -1,2 +1 @@
|
|||
/// <reference types="react" />
|
||||
export default function render(this: any): JSX.Element;
|
||||
|
|
|
|||
|
|
@ -1,2 +1 @@
|
|||
/// <reference types="react" />
|
||||
export default function render(this: any): JSX.Element;
|
||||
|
|
|
|||
|
|
@ -1,2 +1 @@
|
|||
/// <reference types="react" />
|
||||
export default function render(this: any): JSX.Element;
|
||||
|
|
|
|||
|
|
@ -1,2 +1 @@
|
|||
/// <reference types="react" />
|
||||
export default function render(this: any): JSX.Element;
|
||||
|
|
|
|||
|
|
@ -1,2 +1 @@
|
|||
/// <reference types="react" />
|
||||
export default function render(this: any): JSX.Element;
|
||||
|
|
|
|||
|
|
@ -1,2 +1 @@
|
|||
/// <reference types="react" />
|
||||
export default function render(this: any): JSX.Element;
|
||||
|
|
|
|||
|
|
@ -1,2 +1 @@
|
|||
/// <reference types="react" />
|
||||
export default function render(this: any): JSX.Element;
|
||||
|
|
|
|||
|
|
@ -1,2 +1 @@
|
|||
/// <reference types="react" />
|
||||
export default function render(this: any): JSX.Element;
|
||||
|
|
|
|||
|
|
@ -51,6 +51,11 @@ export class BackendRuntimeContext<ED extends EntityDict> extends UniversalConte
|
|||
id: 1,
|
||||
name: 1,
|
||||
config: 1,
|
||||
platformId: 1,
|
||||
platform: {
|
||||
id: 1,
|
||||
config: 1,
|
||||
},
|
||||
},
|
||||
},
|
||||
filter: {
|
||||
|
|
|
|||
|
|
@ -42,11 +42,11 @@ export class FrontendRuntimeContext<ED extends EntityDict, Cxt extends RuntimeCo
|
|||
return this.token?.getTokenValue();
|
||||
}
|
||||
|
||||
async getToken() {
|
||||
async getToken(allowUnloggedIn?: boolean) {
|
||||
return this.token?.getToken();
|
||||
}
|
||||
|
||||
async getCurrentUserId(): Promise<string | undefined> {
|
||||
async getCurrentUserId(allowUnloggedIn?: boolean): Promise<string | undefined> {
|
||||
return this.token?.getUserId();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -13,6 +13,11 @@ export type GetApplicationShape = {
|
|||
id: 1,
|
||||
name: 1,
|
||||
config: 1,
|
||||
platformId: 1,
|
||||
platform: {
|
||||
id: 1,
|
||||
config: 1,
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -21,6 +21,11 @@ const projection: {
|
|||
id: 1,
|
||||
name: 1,
|
||||
config: 1,
|
||||
platformId: 1,
|
||||
platform: {
|
||||
id: 1,
|
||||
config: 1,
|
||||
},
|
||||
}
|
||||
} = {
|
||||
id: 1,
|
||||
|
|
@ -32,6 +37,11 @@ const projection: {
|
|||
id: 1,
|
||||
name: 1,
|
||||
config: 1,
|
||||
platformId: 1,
|
||||
platform: {
|
||||
id: 1,
|
||||
config: 1,
|
||||
},
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
import { Action, Feature } from 'oak-frontend-base/lib/types/Feature';
|
||||
import { RWLock } from 'oak-domain/lib/utils/concurrent';
|
||||
import { OakUnloggedInException } from 'oak-domain/lib/types/Exception';
|
||||
import { Cache } from 'oak-frontend-base/lib/features/cache';
|
||||
import { LocalStorage } from 'oak-frontend-base/lib/features/localStorage';
|
||||
import { CommonAspectDict } from 'oak-common-aspect';
|
||||
|
|
@ -283,18 +284,21 @@ export class Token<
|
|||
return token;
|
||||
}
|
||||
|
||||
async getToken() {
|
||||
async getToken(allowUnloggedIn?: boolean) {
|
||||
if (this.token) {
|
||||
return this.token;
|
||||
}
|
||||
if (this.tokenValue) {
|
||||
await this.loadTokenInfo();
|
||||
}
|
||||
return this.token!;
|
||||
if (allowUnloggedIn || this.token) {
|
||||
return this.token;
|
||||
}
|
||||
throw new OakUnloggedInException();
|
||||
}
|
||||
|
||||
async getUserId() {
|
||||
const token = await this.getToken();
|
||||
async getUserId(allowUnloggedIn?: boolean) {
|
||||
const token = await this.getToken(allowUnloggedIn);
|
||||
return token?.userId as string | undefined;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue