@malevich-studio/strapi-sdk-typescript 1.2.3 → 1.2.5
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/README.md +31 -3
- package/dist/cli.cjs +65 -3
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.mjs +65 -3
- package/dist/cli.mjs.map +1 -1
- package/dist/index.cjs +52 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +20 -2
- package/dist/index.mjs +52 -2
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -20097,6 +20097,9 @@ class Strapi {
|
|
|
20097
20097
|
setToken(token) {
|
|
20098
20098
|
this.token = token;
|
|
20099
20099
|
}
|
|
20100
|
+
getToken() {
|
|
20101
|
+
return this.token;
|
|
20102
|
+
}
|
|
20100
20103
|
async baseLogin(identifier, password) {
|
|
20101
20104
|
const response = await this.fetchData('/auth/local', {
|
|
20102
20105
|
identifier,
|
|
@@ -20104,8 +20107,55 @@ class Strapi {
|
|
|
20104
20107
|
}, {
|
|
20105
20108
|
method: 'POST',
|
|
20106
20109
|
});
|
|
20107
|
-
|
|
20108
|
-
|
|
20110
|
+
if (!response.error) {
|
|
20111
|
+
this.setToken(response.jwt);
|
|
20112
|
+
}
|
|
20113
|
+
return response;
|
|
20114
|
+
}
|
|
20115
|
+
async baseRegister(data) {
|
|
20116
|
+
const response = await this.fetchData('/auth/local/register', data, {
|
|
20117
|
+
method: 'POST',
|
|
20118
|
+
});
|
|
20119
|
+
if (!response.error) {
|
|
20120
|
+
this.setToken(response.jwt);
|
|
20121
|
+
}
|
|
20122
|
+
return response;
|
|
20123
|
+
}
|
|
20124
|
+
async forgotPassword(email) {
|
|
20125
|
+
return await this.fetchData('/auth/forgot-password', { email }, {
|
|
20126
|
+
method: 'POST',
|
|
20127
|
+
});
|
|
20128
|
+
}
|
|
20129
|
+
async sendEmailConfirmation(email) {
|
|
20130
|
+
return await this.fetchData('/auth/send-email-confirmation', { email }, {
|
|
20131
|
+
method: 'POST',
|
|
20132
|
+
});
|
|
20133
|
+
}
|
|
20134
|
+
async baseResetPassword(password, code) {
|
|
20135
|
+
const response = await this.fetchData('/auth/reset-password', {
|
|
20136
|
+
password,
|
|
20137
|
+
passwordConfirmation: password,
|
|
20138
|
+
code,
|
|
20139
|
+
}, {
|
|
20140
|
+
method: 'POST',
|
|
20141
|
+
});
|
|
20142
|
+
if (!response.error) {
|
|
20143
|
+
this.setToken(response.jwt);
|
|
20144
|
+
}
|
|
20145
|
+
return response;
|
|
20146
|
+
}
|
|
20147
|
+
async baseChangePassword(password, currentPassword) {
|
|
20148
|
+
const response = await this.fetchData('/auth/change-password', {
|
|
20149
|
+
password,
|
|
20150
|
+
passwordConfirmation: password,
|
|
20151
|
+
currentPassword,
|
|
20152
|
+
}, {
|
|
20153
|
+
method: 'POST',
|
|
20154
|
+
});
|
|
20155
|
+
if (!response.error) {
|
|
20156
|
+
this.setToken(response.jwt);
|
|
20157
|
+
}
|
|
20158
|
+
return response;
|
|
20109
20159
|
}
|
|
20110
20160
|
async getLocales(params) {
|
|
20111
20161
|
return await this.baseFetch('i18n/locales', _.merge({
|