@malevich-studio/strapi-sdk-typescript 1.2.21 → 1.2.23

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.d.ts CHANGED
@@ -187,6 +187,7 @@ declare class Strapi {
187
187
  getDocument<T, Q extends object>(endpoint: string, data?: Q, params?: RequestInit): Promise<Response<T>>;
188
188
  create<T, Q extends object>(endpoint: string, data: Q, params?: RequestInit): Promise<Response<T>>;
189
189
  update<T, Q extends object>(endpoint: string, id: string, data: Q, params?: RequestInit): Promise<Response<T>>;
190
+ protected updateBaseUser<T, Q extends object>(endpoint: string, id: string, data: Q, params?: RequestInit): Promise<T>;
190
191
  delete<T>(endpoint: string, id: string, params?: RequestInit): Promise<Response<T>>;
191
192
  uploadForm(form: FormData): Promise<File[]>;
192
193
  private baseFetch;
package/dist/index.mjs CHANGED
@@ -21407,6 +21407,12 @@ class Strapi {
21407
21407
  ...params,
21408
21408
  });
21409
21409
  }
21410
+ async updateBaseUser(endpoint, id, data, params = {}) {
21411
+ return await this.fetchData(`${endpoint}/${id}`, data, {
21412
+ method: 'PUT',
21413
+ ...params,
21414
+ });
21415
+ }
21410
21416
  async delete(endpoint, id, params = {}) {
21411
21417
  return await this.fetch(`${endpoint}/${id}`, {}, {
21412
21418
  method: 'DELETE',
@@ -21428,7 +21434,11 @@ class Strapi {
21428
21434
  } : {}),
21429
21435
  }, params);
21430
21436
  const response = await fetch(`${this.url}/api/${endpoint}`, mergedParams);
21431
- const data = await response.json();
21437
+ let data = null;
21438
+ try {
21439
+ data = await response?.json() || null;
21440
+ }
21441
+ catch (error) { }
21432
21442
  log(mergedParams);
21433
21443
  log(response);
21434
21444
  log(data);