@malevich-studio/strapi-sdk-typescript 1.2.9 → 1.2.11
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 +13 -6
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.mjs +13 -6
- package/dist/cli.mjs.map +1 -1
- package/dist/index.cjs +9 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.mjs +9 -6
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -21296,18 +21296,16 @@ class Strapi {
|
|
|
21296
21296
|
this.token = token;
|
|
21297
21297
|
}
|
|
21298
21298
|
async fetch(endpoint, data = {}, params = {}) {
|
|
21299
|
-
|
|
21299
|
+
const queryString = params.method === 'GET' ? qs.stringify(data) : '';
|
|
21300
|
+
return await this.fetchData(queryString ? `${endpoint}?${queryString}` : endpoint, { data }, params);
|
|
21300
21301
|
}
|
|
21301
21302
|
async fetchData(endpoint, data = {}, params = {}) {
|
|
21302
|
-
|
|
21303
|
-
return await this.baseFetch(queryString ? `${endpoint}?${queryString}` : endpoint, _.merge({
|
|
21303
|
+
return await this.baseFetch(endpoint, _.merge({
|
|
21304
21304
|
headers: {
|
|
21305
21305
|
'Content-Type': 'application/json',
|
|
21306
21306
|
},
|
|
21307
21307
|
...(params.method && !['GET', 'DELETE'].includes(params.method) ? {
|
|
21308
|
-
body: JSON.stringify(
|
|
21309
|
-
data,
|
|
21310
|
-
})
|
|
21308
|
+
body: JSON.stringify(data)
|
|
21311
21309
|
} : {}),
|
|
21312
21310
|
}, params));
|
|
21313
21311
|
}
|
|
@@ -21374,6 +21372,11 @@ class Strapi {
|
|
|
21374
21372
|
}
|
|
21375
21373
|
return response;
|
|
21376
21374
|
}
|
|
21375
|
+
async baseMe(data) {
|
|
21376
|
+
return await this.fetchData('users/me', data, {
|
|
21377
|
+
method: 'GET',
|
|
21378
|
+
});
|
|
21379
|
+
}
|
|
21377
21380
|
async getLocales(params) {
|
|
21378
21381
|
return await this.baseFetch('i18n/locales', _.merge({
|
|
21379
21382
|
headers: {
|