@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
|
@@ -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
|
@@ -21282,7 +21282,7 @@ class Strapi {
|
|
|
21282
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
|
-
|
|
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());
|