@readyfor/api-client-base 0.215.0 → 0.215.1
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-XDHAVIKP.mjs → chunk-BNXKKSJH.mjs} +19 -2
- package/dist/fetcher.js +19 -2
- package/dist/fetcher.mjs +1 -1
- package/dist/index.js +19 -2
- package/dist/index.mjs +1 -1
- package/package.json +2 -2
|
@@ -10,8 +10,25 @@ import {
|
|
|
10
10
|
var defaultRequestInit = {
|
|
11
11
|
credentials: "include"
|
|
12
12
|
};
|
|
13
|
-
var createJsonFetcher = (schema, customRequestInit = {}) => (input, requestInit = {}) =>
|
|
14
|
-
|
|
13
|
+
var createJsonFetcher = (schema, customRequestInit = {}) => (input, requestInit = {}) => fetch(input, {
|
|
14
|
+
...defaultRequestInit,
|
|
15
|
+
...customRequestInit,
|
|
16
|
+
...requestInit,
|
|
17
|
+
headers: {
|
|
18
|
+
...defaultRequestInit.headers,
|
|
19
|
+
...customRequestInit.headers,
|
|
20
|
+
...requestInit.headers
|
|
21
|
+
}
|
|
22
|
+
}).then(async (res) => {
|
|
23
|
+
const body = await res.json();
|
|
24
|
+
if (res.ok) return body;
|
|
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) => {
|
|
15
32
|
const result = schema.safeParse(parsedResponse);
|
|
16
33
|
const config = store.getState();
|
|
17
34
|
if (result.success) {
|
package/dist/fetcher.js
CHANGED
|
@@ -101,8 +101,25 @@ var store = createStore(defaultConfig);
|
|
|
101
101
|
var defaultRequestInit = {
|
|
102
102
|
credentials: "include"
|
|
103
103
|
};
|
|
104
|
-
var createJsonFetcher = (schema, customRequestInit = {}) => (input, requestInit = {}) =>
|
|
105
|
-
|
|
104
|
+
var createJsonFetcher = (schema, customRequestInit = {}) => (input, requestInit = {}) => fetch(input, {
|
|
105
|
+
...defaultRequestInit,
|
|
106
|
+
...customRequestInit,
|
|
107
|
+
...requestInit,
|
|
108
|
+
headers: {
|
|
109
|
+
...defaultRequestInit.headers,
|
|
110
|
+
...customRequestInit.headers,
|
|
111
|
+
...requestInit.headers
|
|
112
|
+
}
|
|
113
|
+
}).then(async (res) => {
|
|
114
|
+
const body = await res.json();
|
|
115
|
+
if (res.ok) return body;
|
|
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) => {
|
|
106
123
|
const result = schema.safeParse(parsedResponse);
|
|
107
124
|
const config = store.getState();
|
|
108
125
|
if (result.success) {
|
package/dist/fetcher.mjs
CHANGED
package/dist/index.js
CHANGED
|
@@ -138,8 +138,25 @@ var getErrorStatus = (response) => {
|
|
|
138
138
|
var defaultRequestInit = {
|
|
139
139
|
credentials: "include"
|
|
140
140
|
};
|
|
141
|
-
var createJsonFetcher = (schema, customRequestInit = {}) => (input, requestInit = {}) =>
|
|
142
|
-
|
|
141
|
+
var createJsonFetcher = (schema, customRequestInit = {}) => (input, requestInit = {}) => fetch(input, {
|
|
142
|
+
...defaultRequestInit,
|
|
143
|
+
...customRequestInit,
|
|
144
|
+
...requestInit,
|
|
145
|
+
headers: {
|
|
146
|
+
...defaultRequestInit.headers,
|
|
147
|
+
...customRequestInit.headers,
|
|
148
|
+
...requestInit.headers
|
|
149
|
+
}
|
|
150
|
+
}).then(async (res) => {
|
|
151
|
+
const body = await res.json();
|
|
152
|
+
if (res.ok) return body;
|
|
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) => {
|
|
143
160
|
const result = schema.safeParse(parsedResponse);
|
|
144
161
|
const config = store.getState();
|
|
145
162
|
if (result.success) {
|
package/dist/index.mjs
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@readyfor/api-client-base",
|
|
3
|
-
"version": "0.215.
|
|
3
|
+
"version": "0.215.1",
|
|
4
4
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -63,5 +63,5 @@
|
|
|
63
63
|
"src"
|
|
64
64
|
]
|
|
65
65
|
},
|
|
66
|
-
"gitHead": "
|
|
66
|
+
"gitHead": "c1c49bf1342b35db60025dc78c412de3f6df37a3"
|
|
67
67
|
}
|