@malevich-studio/strapi-sdk-typescript 1.0.7 → 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.
- package/dist/cli.cjs +16 -7
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.mjs +16 -7
- package/dist/cli.mjs.map +1 -1
- package/dist/generator/attributes/date.d.ts +11 -0
- package/dist/index.cjs +4 -7
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.mjs +4 -7
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -1
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
|
-
}))
|
|
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
|
-
|
|
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());
|