systemlynx 1.13.10 → 1.14.10

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "systemlynx",
3
- "version": "1.13.10",
3
+ "version": "1.14.10",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "browser": {
@@ -9,7 +9,9 @@ module.exports = function createHttpClient() {
9
9
  method = method.toLowerCase();
10
10
  try {
11
11
  const res = await axios({ url, method, headers, data });
12
- return res.data;
12
+ if (res.status >= 400) {
13
+ throw res.data;
14
+ } else return res.data;
13
15
  } catch (error) {
14
16
  if (!error.isAxiosError) throw error;
15
17
  if (!error.response) throw error;
@@ -33,7 +35,9 @@ module.exports = function createHttpClient() {
33
35
  const res = await axios.post(url, form, {
34
36
  headers: { ...headers, "Content-Type": "multipart/form-data" },
35
37
  });
36
- return res.data;
38
+ if (res.status >= 400) {
39
+ throw res.data;
40
+ } else return res.data;
37
41
  } catch (error) {
38
42
  if (!error.isAxiosError) throw error;
39
43
  if (!error.response) throw error;