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.
@@ -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.body) {
34
- console.log(res.body);
35
- return res;
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,
@@ -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.body) {
10
- console.log(res.body);
11
- return res;
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,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dn-react-router-toolkit",
3
- "version": "0.2.1",
3
+ "version": "0.2.2",
4
4
  "types": "./dist/index.d.ts",
5
5
  "main": "./dist/index.mjs",
6
6
  "module": "./dist/index.js",