@nocobase/sdk 1.5.0-beta.3 → 1.5.0-beta.30

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.
@@ -17,7 +17,7 @@ type ResourceActionOptions<P = any> = {
17
17
  action?: string;
18
18
  params?: P;
19
19
  };
20
- type ResourceAction = (params?: ActionParams) => Promise<any>;
20
+ type ResourceAction = (params?: ActionParams, opts?: any) => Promise<any>;
21
21
  export type IResource = {
22
22
  [key: string]: ResourceAction;
23
23
  };
package/lib/APIClient.js CHANGED
@@ -126,7 +126,7 @@ const _Auth = class _Auth {
126
126
  * use {@link Auth#locale} instead
127
127
  */
128
128
  getLocale() {
129
- return this.getOption("locale") || "en-US";
129
+ return this.getOption("locale");
130
130
  }
131
131
  /**
132
132
  * @internal
@@ -162,6 +162,11 @@ const _Auth = class _Auth {
162
162
  */
163
163
  setToken(token) {
164
164
  this.setOption("token", token);
165
+ if (this.api["app"]) {
166
+ this.api["app"].eventBus.dispatchEvent(
167
+ new CustomEvent("auth:tokenChanged", { detail: { token, authenticator: this.authenticator } })
168
+ );
169
+ }
165
170
  }
166
171
  /**
167
172
  * @internal
@@ -203,8 +208,8 @@ const _Auth = class _Auth {
203
208
  }
204
209
  });
205
210
  const data = (_a = response == null ? void 0 : response.data) == null ? void 0 : _a.data;
206
- this.setToken(data == null ? void 0 : data.token);
207
211
  this.setAuthenticator(authenticator);
212
+ this.setToken(data == null ? void 0 : data.token);
208
213
  return response;
209
214
  }
210
215
  async signUp(values, authenticator) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nocobase/sdk",
3
- "version": "1.5.0-beta.3",
3
+ "version": "1.5.0-beta.30",
4
4
  "license": "AGPL-3.0",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
@@ -11,5 +11,5 @@
11
11
  "devDependencies": {
12
12
  "axios-mock-adapter": "^1.20.0"
13
13
  },
14
- "gitHead": "81afcf4affdb652faf4636e6d9351828ce8906be"
14
+ "gitHead": "40c48b2ecf3e2315a76dcb729dbda825b6a1331c"
15
15
  }