@bzbs/react-api-client 0.2.0 → 0.2.1

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/index.mjs CHANGED
@@ -74,6 +74,35 @@ var BaseService = class {
74
74
  data
75
75
  };
76
76
  const response = yield this.client.request(__spreadValues({ method, url }, config));
77
+ if (response.status === 204) {
78
+ return { model: "", response, type: "success" };
79
+ }
80
+ if ("Success" in response.data) {
81
+ const data2 = response.data;
82
+ if (data2.Success) {
83
+ if ("Data" in response.data) {
84
+ return { model: data2.Data, response, type: "success" };
85
+ } else {
86
+ return { model: "", response, type: "success" };
87
+ }
88
+ } else {
89
+ const error = {
90
+ type: "server-error",
91
+ error: {
92
+ requestId: response.data.RequestId || "",
93
+ error: {
94
+ id: response.data.Code || 500,
95
+ message: response.data.Message || "An unexpected error occurred.",
96
+ code: response.data.Code || 500,
97
+ type: "buzzebees"
98
+ }
99
+ },
100
+ statusCode: response.data.Code || 500,
101
+ response
102
+ };
103
+ return this.normalizeError(error);
104
+ }
105
+ }
77
106
  return { model: response.data, response, type: "success" };
78
107
  } catch (error) {
79
108
  return this.normalizeError(error);