whio-api-sdk 1.1.1 → 1.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.
|
@@ -85,6 +85,7 @@ export class BaseClient {
|
|
|
85
85
|
method,
|
|
86
86
|
headers: Object.assign(Object.assign({}, defaultHeaders), headers),
|
|
87
87
|
body: body ? JSON.stringify(body) : undefined,
|
|
88
|
+
signal: AbortSignal.timeout(5000),
|
|
88
89
|
});
|
|
89
90
|
if (!response.ok) {
|
|
90
91
|
const errorData = yield response.json().catch(() => ({}));
|
|
@@ -183,6 +184,7 @@ export class BaseClient {
|
|
|
183
184
|
const response = yield fetch(url, {
|
|
184
185
|
method: 'GET',
|
|
185
186
|
headers: defaultHeaders,
|
|
187
|
+
signal: AbortSignal.timeout(5000),
|
|
186
188
|
});
|
|
187
189
|
if (!response.ok) {
|
|
188
190
|
const errorData = yield response.json().catch(() => ({}));
|
|
@@ -235,7 +237,7 @@ export class BaseClient {
|
|
|
235
237
|
});
|
|
236
238
|
}
|
|
237
239
|
isAuthenticated() {
|
|
238
|
-
return !!this.accessToken && !!this.user;
|
|
240
|
+
return !!this.accessToken && !!this.user && !this.isTokenExpired(this.accessToken);
|
|
239
241
|
}
|
|
240
242
|
getCurrentUser() {
|
|
241
243
|
return this.user;
|
package/package.json
CHANGED
|
@@ -86,6 +86,7 @@ export class BaseClient {
|
|
|
86
86
|
method,
|
|
87
87
|
headers: { ...defaultHeaders, ...headers },
|
|
88
88
|
body: body ? JSON.stringify(body) : undefined,
|
|
89
|
+
signal: AbortSignal.timeout(5000),
|
|
89
90
|
});
|
|
90
91
|
|
|
91
92
|
if (!response.ok) {
|
|
@@ -205,6 +206,7 @@ export class BaseClient {
|
|
|
205
206
|
const response = await fetch(url, {
|
|
206
207
|
method: 'GET',
|
|
207
208
|
headers: defaultHeaders,
|
|
209
|
+
signal: AbortSignal.timeout(5000),
|
|
208
210
|
});
|
|
209
211
|
|
|
210
212
|
if (!response.ok) {
|
|
@@ -268,7 +270,7 @@ export class BaseClient {
|
|
|
268
270
|
}
|
|
269
271
|
|
|
270
272
|
public isAuthenticated(): boolean {
|
|
271
|
-
return !!this.accessToken && !!this.user;
|
|
273
|
+
return !!this.accessToken && !!this.user && !this.isTokenExpired(this.accessToken);
|
|
272
274
|
}
|
|
273
275
|
|
|
274
276
|
public getCurrentUser(): User | null {
|