@malevich-studio/strapi-sdk-typescript 1.0.7 → 1.0.9

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
@@ -124,8 +124,8 @@ declare class Strapi {
124
124
  upload(files: {
125
125
  path: string;
126
126
  filename?: string;
127
- }[]): Promise<File>;
128
- uploadForm(form: FormData): Promise<File>;
127
+ }[]): Promise<File[]>;
128
+ uploadForm(form: FormData): Promise<File[]>;
129
129
  private baseRequest;
130
130
  }
131
131
 
package/dist/index.mjs CHANGED
@@ -21280,7 +21280,7 @@ class Strapi {
21280
21280
  return (await this.baseRequest('upload', {
21281
21281
  method: 'POST',
21282
21282
  body: form,
21283
- })).data;
21283
+ }));
21284
21284
  }
21285
21285
  async baseRequest(endpoint, params = {}) {
21286
21286
  const response = await fetch(`${this.url}/api/${endpoint}`, _.merge({
@@ -21290,13 +21290,10 @@ class Strapi {
21290
21290
  }, params));
21291
21291
  if (!response.ok) {
21292
21292
  console.log(`${this.url}/api/${endpoint}`);
21293
- console.log(_.merge({
21294
- headers: {
21295
- Authorization: `Bearer ${this.token}`,
21296
- },
21297
- }, params));
21298
21293
  console.log(response);
21299
- console.log(await response.json());
21294
+ const data = await response.json();
21295
+ console.log(data);
21296
+ console.log(data?.error?.details?.errors);
21300
21297
  throw new Error(`Помилка запиту до Strapi: ${response.status} ${response.statusText}`);
21301
21298
  }
21302
21299
  return (await response.json());