@bzbs/react-api-client 1.4.8 → 1.4.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/dist/index.mjs CHANGED
@@ -156,6 +156,18 @@ var BaseService = class {
156
156
  this.baseUrl = baseUrl;
157
157
  return this;
158
158
  }
159
+ static createFormData(data, fileKey, file) {
160
+ const formData = new FormData();
161
+ for (const key in data) {
162
+ if (data[key]) {
163
+ formData.append(key, data[key]);
164
+ }
165
+ }
166
+ if (file) {
167
+ formData.append(fileKey != null ? fileKey : "data", file);
168
+ }
169
+ return formData;
170
+ }
159
171
  };
160
172
 
161
173
  // src/api/auth/auth-api.ts
@@ -1765,8 +1777,7 @@ var ProfileApi = class extends BaseService {
1765
1777
  return __async(this, null, function* () {
1766
1778
  return yield this.post(
1767
1779
  "profile/me",
1768
- __spreadValues({
1769
- data: params.profileImage,
1780
+ BaseService.createFormData(__spreadValues({
1770
1781
  firstname: params.firstName,
1771
1782
  lastname: params.lastName,
1772
1783
  contact_number: params.contactNumber,
@@ -1814,7 +1825,7 @@ var ProfileApi = class extends BaseService {
1814
1825
  occupation: params.occupation,
1815
1826
  remark: params.remark,
1816
1827
  displayname: params.displayName
1817
- }, params.options),
1828
+ }, params.options), "data", params.profileImage),
1818
1829
  {
1819
1830
  headers: __spreadValues({
1820
1831
  "Content-Type": "multipart/form-data"