@readyfor/api-client-base 0.215.0-pr977.a653f09 → 0.215.0-pr977.c06f33c
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/{chunk-BNXKKSJH.mjs → chunk-Q3TOTGEF.mjs} +6 -18
- package/dist/fetcher.js +6 -18
- package/dist/fetcher.mjs +1 -1
- package/dist/index.js +6 -18
- package/dist/index.mjs +1 -1
- package/package.json +1 -1
|
@@ -10,25 +10,13 @@ import {
|
|
|
10
10
|
var defaultRequestInit = {
|
|
11
11
|
credentials: "include"
|
|
12
12
|
};
|
|
13
|
-
var createJsonFetcher = (schema, customRequestInit = {}) => (input, requestInit = {}) =>
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
...requestInit,
|
|
17
|
-
headers: {
|
|
18
|
-
...defaultRequestInit.headers,
|
|
19
|
-
...customRequestInit.headers,
|
|
20
|
-
...requestInit.headers
|
|
13
|
+
var createJsonFetcher = (schema, customRequestInit = {}) => (input, requestInit = {}) => createTextFetcher(customRequestInit)(input, requestInit).catch((e) => {
|
|
14
|
+
if (e instanceof HTTPError && typeof e.body === "string" && e.body.length > 0) {
|
|
15
|
+
throw new HTTPError(e.status, JSON.parse(e.body));
|
|
21
16
|
}
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
const code = Object.values(errorStatusCode).includes(res.status) ? res.status : 999;
|
|
26
|
-
const error = new HTTPError(code, body);
|
|
27
|
-
throw error;
|
|
28
|
-
}).catch((error) => {
|
|
29
|
-
store.getState().onError?.(error);
|
|
30
|
-
throw error;
|
|
31
|
-
}).then((parsedResponse) => {
|
|
17
|
+
throw e;
|
|
18
|
+
}).then((text) => {
|
|
19
|
+
const parsedResponse = JSON.parse(text);
|
|
32
20
|
const result = schema.safeParse(parsedResponse);
|
|
33
21
|
const config = store.getState();
|
|
34
22
|
if (result.success) {
|
package/dist/fetcher.js
CHANGED
|
@@ -101,25 +101,13 @@ var store = createStore(defaultConfig);
|
|
|
101
101
|
var defaultRequestInit = {
|
|
102
102
|
credentials: "include"
|
|
103
103
|
};
|
|
104
|
-
var createJsonFetcher = (schema, customRequestInit = {}) => (input, requestInit = {}) =>
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
...requestInit,
|
|
108
|
-
headers: {
|
|
109
|
-
...defaultRequestInit.headers,
|
|
110
|
-
...customRequestInit.headers,
|
|
111
|
-
...requestInit.headers
|
|
104
|
+
var createJsonFetcher = (schema, customRequestInit = {}) => (input, requestInit = {}) => createTextFetcher(customRequestInit)(input, requestInit).catch((e) => {
|
|
105
|
+
if (e instanceof HTTPError && typeof e.body === "string" && e.body.length > 0) {
|
|
106
|
+
throw new HTTPError(e.status, JSON.parse(e.body));
|
|
112
107
|
}
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
const code = Object.values(errorStatusCode).includes(res.status) ? res.status : 999;
|
|
117
|
-
const error = new HTTPError(code, body);
|
|
118
|
-
throw error;
|
|
119
|
-
}).catch((error) => {
|
|
120
|
-
store.getState().onError?.(error);
|
|
121
|
-
throw error;
|
|
122
|
-
}).then((parsedResponse) => {
|
|
108
|
+
throw e;
|
|
109
|
+
}).then((text) => {
|
|
110
|
+
const parsedResponse = JSON.parse(text);
|
|
123
111
|
const result = schema.safeParse(parsedResponse);
|
|
124
112
|
const config = store.getState();
|
|
125
113
|
if (result.success) {
|
package/dist/fetcher.mjs
CHANGED
package/dist/index.js
CHANGED
|
@@ -138,25 +138,13 @@ var getErrorStatus = (response) => {
|
|
|
138
138
|
var defaultRequestInit = {
|
|
139
139
|
credentials: "include"
|
|
140
140
|
};
|
|
141
|
-
var createJsonFetcher = (schema, customRequestInit = {}) => (input, requestInit = {}) =>
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
...requestInit,
|
|
145
|
-
headers: {
|
|
146
|
-
...defaultRequestInit.headers,
|
|
147
|
-
...customRequestInit.headers,
|
|
148
|
-
...requestInit.headers
|
|
141
|
+
var createJsonFetcher = (schema, customRequestInit = {}) => (input, requestInit = {}) => createTextFetcher(customRequestInit)(input, requestInit).catch((e) => {
|
|
142
|
+
if (e instanceof HTTPError && typeof e.body === "string" && e.body.length > 0) {
|
|
143
|
+
throw new HTTPError(e.status, JSON.parse(e.body));
|
|
149
144
|
}
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
const code = Object.values(errorStatusCode).includes(res.status) ? res.status : 999;
|
|
154
|
-
const error = new HTTPError(code, body);
|
|
155
|
-
throw error;
|
|
156
|
-
}).catch((error) => {
|
|
157
|
-
store.getState().onError?.(error);
|
|
158
|
-
throw error;
|
|
159
|
-
}).then((parsedResponse) => {
|
|
145
|
+
throw e;
|
|
146
|
+
}).then((text) => {
|
|
147
|
+
const parsedResponse = JSON.parse(text);
|
|
160
148
|
const result = schema.safeParse(parsedResponse);
|
|
161
149
|
const config = store.getState();
|
|
162
150
|
if (result.success) {
|
package/dist/index.mjs
CHANGED