@resistdesign/voltra 3.0.0-alpha.37 → 3.0.0-alpha.38
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/app/index.js +17 -4
- package/package.json +1 -1
package/app/index.js
CHANGED
|
@@ -166,11 +166,24 @@ var sendServiceRequest = async (config, path = "", args = []) => {
|
|
|
166
166
|
body: JSON.stringify(args)
|
|
167
167
|
});
|
|
168
168
|
const { ok: responseIsOk } = response;
|
|
169
|
-
const
|
|
170
|
-
|
|
171
|
-
|
|
169
|
+
const textData = await response.text();
|
|
170
|
+
let data = textData;
|
|
171
|
+
try {
|
|
172
|
+
data = JSON.parse(textData);
|
|
173
|
+
} catch (error) {
|
|
174
|
+
}
|
|
175
|
+
if (typeof data === "object") {
|
|
176
|
+
if (responseIsOk) {
|
|
177
|
+
return data;
|
|
178
|
+
} else {
|
|
179
|
+
throw data;
|
|
180
|
+
}
|
|
172
181
|
} else {
|
|
173
|
-
|
|
182
|
+
if (responseIsOk) {
|
|
183
|
+
return { data };
|
|
184
|
+
} else {
|
|
185
|
+
throw { message: data };
|
|
186
|
+
}
|
|
174
187
|
}
|
|
175
188
|
};
|
|
176
189
|
var useApplicationStateLoader = (config) => {
|