whio-api-sdk 1.0.153 → 1.0.155
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/dist/src/sdk/sdk.d.ts +1 -0
- package/dist/src/sdk/sdk.js +10 -0
- package/package.json +1 -1
- package/src/sdk/sdk.ts +9 -0
package/dist/src/sdk/sdk.d.ts
CHANGED
package/dist/src/sdk/sdk.js
CHANGED
|
@@ -23,6 +23,16 @@ export class ApiSDK {
|
|
|
23
23
|
};
|
|
24
24
|
this.initialize();
|
|
25
25
|
}
|
|
26
|
+
fetchConfig(url) {
|
|
27
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
28
|
+
const response = yield fetch(url);
|
|
29
|
+
if (!response.ok) {
|
|
30
|
+
throw new Error(`Failed to fetch config from ${url}`);
|
|
31
|
+
}
|
|
32
|
+
const conf = yield response.json();
|
|
33
|
+
this.baseUrl = conf.baseUrl || this.baseUrl;
|
|
34
|
+
});
|
|
35
|
+
}
|
|
26
36
|
getToken() {
|
|
27
37
|
return __awaiter(this, void 0, void 0, function* () {
|
|
28
38
|
this.accessToken = yield this.storage.getItem('access_token');
|
package/package.json
CHANGED
package/src/sdk/sdk.ts
CHANGED
|
@@ -46,6 +46,15 @@ export class ApiSDK {
|
|
|
46
46
|
this.initialize();
|
|
47
47
|
}
|
|
48
48
|
|
|
49
|
+
public async fetchConfig(url: string): Promise<void> {
|
|
50
|
+
const response = await fetch(url);
|
|
51
|
+
if (!response.ok) {
|
|
52
|
+
throw new Error(`Failed to fetch config from ${url}`);
|
|
53
|
+
}
|
|
54
|
+
const conf = await response.json();
|
|
55
|
+
this.baseUrl = conf.baseUrl || this.baseUrl;
|
|
56
|
+
}
|
|
57
|
+
|
|
49
58
|
private async getToken() {
|
|
50
59
|
this.accessToken = await this.storage!.getItem('access_token');
|
|
51
60
|
if (!this.accessToken) {
|