@symbo.ls/fetch 2.10.163 → 2.10.168

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/cjs/index.js CHANGED
@@ -55,7 +55,7 @@ const fetchRemote = async (key, options = defaultOptions) => {
55
55
  } catch (e) {
56
56
  console.error(e);
57
57
  }
58
- return await response ? response.json() : {};
58
+ return await response.json();
59
59
  };
60
60
  const fetchProject = async (key, options) => {
61
61
  const { editor } = options;
@@ -63,9 +63,13 @@ const fetchProject = async (key, options) => {
63
63
  const data = await fetchRemote(key, editor);
64
64
  const evalData = deepDestringify(data);
65
65
  if (editor.serviceRoute) {
66
- overwriteDeep(options[editor.serviceRoute], evalData);
67
- } else
68
- overwriteDeep(options, evalData);
66
+ overwriteDeep(evalData, options[editor.serviceRoute]);
67
+ } else {
68
+ const obj = { ...evalData, designSystem: evalData.designsystem };
69
+ delete obj.designsystem;
70
+ overwriteDeep(obj, options);
71
+ }
72
+ console.log(options);
69
73
  }
70
74
  return options;
71
75
  };
@@ -74,6 +78,8 @@ const fetchStateAsync = async (key, options, callback) => {
74
78
  if (editor && editor.remote) {
75
79
  const data = await fetchRemote(key, editor);
76
80
  const state = editor.serviceRoute === "state" ? data : data.state;
81
+ console.log(editor);
82
+ console.log(state);
77
83
  if (isObject(state))
78
84
  callback(state);
79
85
  }
package/index.js CHANGED
@@ -32,7 +32,7 @@ export const fetchRemote = async (key, options = defaultOptions) => {
32
32
  console.error(e)
33
33
  }
34
34
 
35
- return await response ? response.json() : {}
35
+ return await response.json()
36
36
  }
37
37
 
38
38
  export const fetchProject = async (key, options) => {
@@ -43,8 +43,14 @@ export const fetchProject = async (key, options) => {
43
43
  const evalData = deepDestringify(data)
44
44
 
45
45
  if (editor.serviceRoute) {
46
- overwriteDeep(options[editor.serviceRoute], evalData)
47
- } else overwriteDeep(options, evalData)
46
+ overwriteDeep(evalData, options[editor.serviceRoute])
47
+ } else {
48
+ const obj = { ...evalData, designSystem: evalData.designsystem }
49
+ delete obj.designsystem
50
+ overwriteDeep(obj, options)
51
+ }
52
+
53
+ console.log(options)
48
54
  }
49
55
 
50
56
  return options
@@ -56,6 +62,8 @@ export const fetchStateAsync = async (key, options, callback) => {
56
62
  if (editor && editor.remote) {
57
63
  const data = await fetchRemote(key, editor)
58
64
  const state = editor.serviceRoute === 'state' ? data : data.state
65
+ console.log(editor)
66
+ console.log(state)
59
67
  if (isObject(state)) callback(state)
60
68
  }
61
69
  }
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@symbo.ls/fetch",
3
- "version": "2.10.163",
3
+ "version": "2.10.168",
4
4
  "license": "MIT",
5
- "gitHead": "9b654d48bb8ba26e3b1b7095b5ed7b813b61e1e0",
5
+ "gitHead": "c9937422aa846691fa6187c7a3975c313114617a",
6
6
  "type": "module",
7
7
  "module": "index.js",
8
8
  "main": "index.js",