@hexdspace/react 0.0.25 → 0.0.26
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/index.d.ts +3 -1
- package/dist/index.js +13 -5
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -524,7 +524,7 @@ var FetchHttpClient = class {
|
|
|
524
524
|
const data = await (res.headers.get("content-type")?.includes("application/json") ? res.json() : res.text());
|
|
525
525
|
if (!res.ok) {
|
|
526
526
|
const errorResponse = data;
|
|
527
|
-
const message = errorResponse?.
|
|
527
|
+
const message = errorResponse?.message ?? res.statusText;
|
|
528
528
|
throw new HttpError(message, res.status, errorResponse);
|
|
529
529
|
}
|
|
530
530
|
return {
|
|
@@ -535,7 +535,11 @@ var FetchHttpClient = class {
|
|
|
535
535
|
} catch (err) {
|
|
536
536
|
if (err instanceof HttpError) throw err;
|
|
537
537
|
const message = err instanceof Error ? err.message : "HTTP request failed";
|
|
538
|
-
throw new HttpError(message, 0, {
|
|
538
|
+
throw new HttpError(message, 0, {
|
|
539
|
+
name: "Error",
|
|
540
|
+
message: JSON.stringify(err),
|
|
541
|
+
status: 500
|
|
542
|
+
});
|
|
539
543
|
}
|
|
540
544
|
}
|
|
541
545
|
resolve(url) {
|
|
@@ -550,7 +554,11 @@ async function refresh(httpClient2) {
|
|
|
550
554
|
if (err instanceof HttpError) {
|
|
551
555
|
return nok(err);
|
|
552
556
|
} else {
|
|
553
|
-
return nok(new HttpError("Unknown error during refresh", 0, {
|
|
557
|
+
return nok(new HttpError("Unknown error during refresh", 0, {
|
|
558
|
+
name: "Error",
|
|
559
|
+
message: JSON.stringify(err),
|
|
560
|
+
status: 500
|
|
561
|
+
}));
|
|
554
562
|
}
|
|
555
563
|
}
|
|
556
564
|
}
|
|
@@ -872,7 +880,7 @@ function dispatchRegisterResult(res, dispatch) {
|
|
|
872
880
|
}
|
|
873
881
|
function getErrorMessage(error) {
|
|
874
882
|
if (error instanceof HttpError) {
|
|
875
|
-
return error.response.
|
|
883
|
+
return error.response.message;
|
|
876
884
|
}
|
|
877
885
|
return error.message;
|
|
878
886
|
}
|
|
@@ -973,7 +981,7 @@ function httpResponse(data, status = 200) {
|
|
|
973
981
|
return { data, status, headers: {} };
|
|
974
982
|
}
|
|
975
983
|
function unauthorized() {
|
|
976
|
-
return new HttpError("Unauthorized", 401, {
|
|
984
|
+
return new HttpError("Unauthorized", 401, { message: "Unauthorized", status: 401, name: "Unauthorized" });
|
|
977
985
|
}
|
|
978
986
|
var MockAuthHttpClient = class extends MockHttpClient {
|
|
979
987
|
fixtures;
|