@malevich-studio/strapi-sdk-typescript 1.0.6 → 1.0.8

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.
@@ -0,0 +1,11 @@
1
+ import Base from "@/generator/attributes/base";
2
+ import type { BaseAttribute } from "@/generator/attributes/base";
3
+ export type DateAttribute = BaseAttribute & {
4
+ type: 'date';
5
+ };
6
+ export default class Date extends Base {
7
+ protected readonly name: string;
8
+ protected readonly attribute: DateAttribute;
9
+ constructor(name: string, attribute: DateAttribute);
10
+ getType(): string;
11
+ }
package/dist/index.cjs CHANGED
@@ -21279,10 +21279,10 @@ class Strapi {
21279
21279
  return await this.uploadForm(form);
21280
21280
  }
21281
21281
  async uploadForm(form) {
21282
- return await this.baseRequest('upload', {
21282
+ return (await this.baseRequest('upload', {
21283
21283
  method: 'POST',
21284
21284
  body: form,
21285
- });
21285
+ }));
21286
21286
  }
21287
21287
  async baseRequest(endpoint, params = {}) {
21288
21288
  const response = await fetch(`${this.url}/api/${endpoint}`, _.merge({
@@ -21292,13 +21292,10 @@ class Strapi {
21292
21292
  }, params));
21293
21293
  if (!response.ok) {
21294
21294
  console.log(`${this.url}/api/${endpoint}`);
21295
- console.log(_.merge({
21296
- headers: {
21297
- Authorization: `Bearer ${this.token}`,
21298
- },
21299
- }, params));
21300
21295
  console.log(response);
21301
- console.log(await response.json());
21296
+ const data = await response.json();
21297
+ console.log(data);
21298
+ console.log(data?.error?.details?.errors);
21302
21299
  throw new Error(`Помилка запиту до Strapi: ${response.status} ${response.statusText}`);
21303
21300
  }
21304
21301
  return (await response.json());