@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.
- package/dist/cli.cjs +17 -8
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.mjs +17 -8
- package/dist/cli.mjs.map +1 -1
- package/dist/generator/attributes/date.d.ts +11 -0
- package/dist/index.cjs +5 -8
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +5 -8
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -1
package/dist/index.mjs
CHANGED
|
@@ -21277,10 +21277,10 @@ class Strapi {
|
|
|
21277
21277
|
return await this.uploadForm(form);
|
|
21278
21278
|
}
|
|
21279
21279
|
async uploadForm(form) {
|
|
21280
|
-
return await this.baseRequest('upload', {
|
|
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());
|