dn-react-router-toolkit 0.2.1 → 0.2.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.
- package/dist/auth/with_auth.js +10 -3
- package/dist/auth/with_auth.mjs +10 -3
- package/package.json +1 -1
package/dist/auth/with_auth.js
CHANGED
|
@@ -30,10 +30,17 @@ function createWithAuthHandler({ authService }) {
|
|
|
30
30
|
const res = await fn(auth)(arg);
|
|
31
31
|
if (typeof res === "object" && res !== null && !Array.isArray(res)) {
|
|
32
32
|
if (res instanceof Response) {
|
|
33
|
-
if (res.status < 300 && res.
|
|
34
|
-
|
|
35
|
-
return
|
|
33
|
+
if (res.status < 300 && res.headers.get("Content-Type")?.includes("application/json")) {
|
|
34
|
+
const data = await res.json();
|
|
35
|
+
return new Response(JSON.stringify({
|
|
36
|
+
AUTH: auth,
|
|
37
|
+
...data
|
|
38
|
+
}), {
|
|
39
|
+
status: res.status,
|
|
40
|
+
headers: res.headers
|
|
41
|
+
});
|
|
36
42
|
}
|
|
43
|
+
return res;
|
|
37
44
|
}
|
|
38
45
|
return {
|
|
39
46
|
AUTH: auth,
|
package/dist/auth/with_auth.mjs
CHANGED
|
@@ -6,10 +6,17 @@ function createWithAuthHandler({ authService }) {
|
|
|
6
6
|
const res = await fn(auth)(arg);
|
|
7
7
|
if (typeof res === "object" && res !== null && !Array.isArray(res)) {
|
|
8
8
|
if (res instanceof Response) {
|
|
9
|
-
if (res.status < 300 && res.
|
|
10
|
-
|
|
11
|
-
return
|
|
9
|
+
if (res.status < 300 && res.headers.get("Content-Type")?.includes("application/json")) {
|
|
10
|
+
const data = await res.json();
|
|
11
|
+
return new Response(JSON.stringify({
|
|
12
|
+
AUTH: auth,
|
|
13
|
+
...data
|
|
14
|
+
}), {
|
|
15
|
+
status: res.status,
|
|
16
|
+
headers: res.headers
|
|
17
|
+
});
|
|
12
18
|
}
|
|
19
|
+
return res;
|
|
13
20
|
}
|
|
14
21
|
return {
|
|
15
22
|
AUTH: auth,
|