@overmap-ai/core 1.0.49-fix-error-messaging.1 → 1.0.49-fix-error-messaging.3
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/overmap-core.js +28 -19
- package/dist/overmap-core.js.map +1 -1
- package/dist/overmap-core.umd.cjs +28 -19
- package/dist/overmap-core.umd.cjs.map +1 -1
- package/dist/store/store.d.ts +1 -1
- package/package.json +1 -1
package/dist/overmap-core.js
CHANGED
|
@@ -4322,10 +4322,20 @@ async function performRequest(action, client) {
|
|
|
4322
4322
|
innerError: error2
|
|
4323
4323
|
});
|
|
4324
4324
|
}
|
|
4325
|
-
|
|
4326
|
-
|
|
4327
|
-
|
|
4328
|
-
|
|
4325
|
+
if (state.authReducer.isLoggedIn) {
|
|
4326
|
+
console.debug("Forbidden; renewing tokens and retrying.");
|
|
4327
|
+
await client.auth.renewTokens();
|
|
4328
|
+
console.debug("Successfully renewed tokens; retrying request.");
|
|
4329
|
+
return requestToSend.query(queryParams);
|
|
4330
|
+
} else {
|
|
4331
|
+
console.debug("Forbidden; user is not logged in.");
|
|
4332
|
+
throw new APIError({
|
|
4333
|
+
message: "Incorrect username or password.",
|
|
4334
|
+
response: errorResponse,
|
|
4335
|
+
discard: true,
|
|
4336
|
+
innerError: error2
|
|
4337
|
+
});
|
|
4338
|
+
}
|
|
4329
4339
|
}
|
|
4330
4340
|
throw new APIError({ response: errorResponse, innerError: error2, discard: discardStatuses.includes(status) });
|
|
4331
4341
|
}
|
|
@@ -5140,24 +5150,23 @@ class AuthService extends BaseApiService {
|
|
|
5140
5150
|
*/
|
|
5141
5151
|
__publicField(this, "_getTokenPair", (credentials, logoutOnFailure = true) => {
|
|
5142
5152
|
const uuid = v4();
|
|
5143
|
-
|
|
5144
|
-
|
|
5145
|
-
|
|
5146
|
-
|
|
5147
|
-
|
|
5148
|
-
|
|
5149
|
-
|
|
5150
|
-
|
|
5151
|
-
|
|
5152
|
-
|
|
5153
|
-
|
|
5154
|
-
return [responsePromise.then(parseTokens), uuid];
|
|
5155
|
-
} catch (e) {
|
|
5153
|
+
const responsePromise = this.enqueueRequest({
|
|
5154
|
+
uuid,
|
|
5155
|
+
description: "Get token pair",
|
|
5156
|
+
method: HttpMethod.POST,
|
|
5157
|
+
url: "/api/token/",
|
|
5158
|
+
payload: credentials,
|
|
5159
|
+
isAuthNeeded: false,
|
|
5160
|
+
checkAuth: false,
|
|
5161
|
+
blockers: [],
|
|
5162
|
+
blocks: []
|
|
5163
|
+
}).then(parseTokens).catch((e) => {
|
|
5156
5164
|
if (logoutOnFailure) {
|
|
5157
5165
|
void this.logout().then();
|
|
5158
5166
|
}
|
|
5159
5167
|
throw e;
|
|
5160
|
-
}
|
|
5168
|
+
});
|
|
5169
|
+
return [responsePromise, uuid];
|
|
5161
5170
|
});
|
|
5162
5171
|
/**
|
|
5163
5172
|
* Takes refresh token and gets a new token pair
|
|
@@ -5218,7 +5227,7 @@ class AuthService extends BaseApiService {
|
|
|
5218
5227
|
timedOut = true;
|
|
5219
5228
|
store.dispatch(markForDeletion(uuid));
|
|
5220
5229
|
store.dispatch(markForDeletion(initialDataUuid));
|
|
5221
|
-
reject(new
|
|
5230
|
+
reject(new APIError({ message: `Request timed out after ${timeout} seconds` }));
|
|
5222
5231
|
}, timeout * 1e3);
|
|
5223
5232
|
});
|
|
5224
5233
|
const successPromise = promise.then((tokens) => {
|