@workopilot/webapp-sdk 0.1.1 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/http.js +6 -2
- package/dist/index.d.ts +1 -1
- package/dist/types.d.ts +11 -0
- package/package.json +1 -1
package/README.md
CHANGED
package/dist/http.js
CHANGED
|
@@ -107,7 +107,8 @@ export class WiseAiFrontSdk {
|
|
|
107
107
|
this.tokenKey = options.tokenKey || 'accessToken';
|
|
108
108
|
this.tokenStorageKey = options.tokenStorageKey || 'accessToken';
|
|
109
109
|
this.uploadPath = options.uploadPath || '/api/file/upload';
|
|
110
|
-
this.routePermissionPath =
|
|
110
|
+
this.routePermissionPath =
|
|
111
|
+
options.routePermissionPath || '/api/PluginApp/GetRouters';
|
|
111
112
|
this.loginRequest = options.loginRequest;
|
|
112
113
|
}
|
|
113
114
|
get state() {
|
|
@@ -339,12 +340,15 @@ export class WiseAiFrontSdk {
|
|
|
339
340
|
});
|
|
340
341
|
}
|
|
341
342
|
async getRoutePermissions() {
|
|
342
|
-
const response = await this.get(this.routePermissionPath,
|
|
343
|
+
const response = await this.get(this.routePermissionPath, { appCode: this.appCode }, {
|
|
343
344
|
base: 'net',
|
|
344
345
|
});
|
|
345
346
|
if (Array.isArray(response)) {
|
|
346
347
|
return response;
|
|
347
348
|
}
|
|
349
|
+
if (response.code !== undefined && response.code !== 200) {
|
|
350
|
+
throw new Error(response.msg || 'WiseAiFrontSDK: failed to get route permissions');
|
|
351
|
+
}
|
|
348
352
|
return response.data || response.rows || [];
|
|
349
353
|
}
|
|
350
354
|
clearToken() {
|
package/dist/index.d.ts
CHANGED
|
@@ -2,6 +2,6 @@ export { decodeJwtPayload, isJwtExpired } from './jwt';
|
|
|
2
2
|
export { notifyReloginRequired } from './bridge';
|
|
3
3
|
import { WiseAiFrontSdk } from './http';
|
|
4
4
|
export { persistToken, resolveTokenFromStorage } from './storage';
|
|
5
|
-
export type { ApiBase, HttpMethod, JwtPayload, LoginCredentials, LoginModalOptions, LoginResult, MenuPermissionNode, RequestBodyType, RequestOptions, UploadOptions, WiseAiEnvironment, WiseAiFrontSdkOptions, WiseAiFrontSdkState, } from './types';
|
|
5
|
+
export type { ApiBase, HttpMethod, JwtPayload, LoginCredentials, LoginModalOptions, LoginResult, MenuPermissionNode, MenuRouteMeta, RequestBodyType, RequestOptions, UploadOptions, WiseAiEnvironment, WiseAiFrontSdkOptions, WiseAiFrontSdkState, } from './types';
|
|
6
6
|
export { WiseAiFrontSdk } from './http';
|
|
7
7
|
export declare function createWiseAiFrontSdk(options: import('./types').WiseAiFrontSdkOptions): WiseAiFrontSdk;
|
package/dist/types.d.ts
CHANGED
|
@@ -34,11 +34,22 @@ export interface JwtPayload {
|
|
|
34
34
|
[key: string]: unknown;
|
|
35
35
|
}
|
|
36
36
|
export interface MenuPermissionNode {
|
|
37
|
+
alwaysShow?: boolean;
|
|
37
38
|
children?: MenuPermissionNode[];
|
|
39
|
+
component?: string;
|
|
38
40
|
hidden?: boolean;
|
|
39
41
|
icon?: string;
|
|
42
|
+
meta?: MenuRouteMeta;
|
|
40
43
|
name?: string;
|
|
41
44
|
path: string;
|
|
45
|
+
query?: string;
|
|
46
|
+
redirect?: string;
|
|
47
|
+
}
|
|
48
|
+
export interface MenuRouteMeta {
|
|
49
|
+
activeMenu?: string;
|
|
50
|
+
icon?: string;
|
|
51
|
+
link?: string;
|
|
52
|
+
noCache?: boolean;
|
|
42
53
|
title?: string;
|
|
43
54
|
}
|
|
44
55
|
export interface RequestOptions {
|