2016-05-01 15:58:54 +05:30
|
|
|
import request from 'services/request';
|
|
|
|
|
|
|
|
export default {
|
2016-10-30 17:42:49 +05:30
|
|
|
/**
|
|
|
|
* @param {object} options
|
2016-11-08 12:00:53 +05:30
|
|
|
* @param {object} [options.token] - an optional token to overwrite headers
|
|
|
|
* in middleware and disable token auto-refresh
|
2016-10-30 17:42:49 +05:30
|
|
|
*
|
|
|
|
* @return {Promise<User>}
|
|
|
|
*/
|
|
|
|
current(options = {}) {
|
|
|
|
return request.get('/api/accounts/current', {}, {
|
2016-11-08 12:00:53 +05:30
|
|
|
token: options.token
|
2016-10-30 17:42:49 +05:30
|
|
|
});
|
2016-05-01 15:58:54 +05:30
|
|
|
},
|
|
|
|
|
2016-10-10 00:20:34 +05:30
|
|
|
changePassword({
|
|
|
|
password = '',
|
|
|
|
newPassword = '',
|
|
|
|
newRePassword = '',
|
|
|
|
logoutAll = true
|
|
|
|
}) {
|
|
|
|
return request.post(
|
|
|
|
'/api/accounts/change-password',
|
|
|
|
{password, newPassword, newRePassword, logoutAll}
|
|
|
|
);
|
|
|
|
},
|
|
|
|
|
2016-08-03 00:29:29 +05:30
|
|
|
acceptRules() {
|
|
|
|
return request.post('/api/accounts/accept-rules');
|
|
|
|
},
|
|
|
|
|
2016-05-02 18:43:18 +05:30
|
|
|
changeUsername({
|
|
|
|
username = '',
|
|
|
|
password = ''
|
|
|
|
}) {
|
|
|
|
return request.post(
|
|
|
|
'/api/accounts/change-username',
|
|
|
|
{username, password}
|
|
|
|
);
|
2016-05-20 01:11:43 +05:30
|
|
|
},
|
|
|
|
|
|
|
|
changeLang(lang) {
|
|
|
|
return request.post(
|
|
|
|
'/api/accounts/change-lang',
|
|
|
|
{lang}
|
|
|
|
);
|
2016-05-22 13:23:40 +05:30
|
|
|
},
|
|
|
|
|
2016-05-23 00:34:52 +05:30
|
|
|
requestEmailChange({password = ''}) {
|
2016-05-22 13:23:40 +05:30
|
|
|
return request.post(
|
2016-05-23 00:34:52 +05:30
|
|
|
'/api/accounts/change-email/initialize',
|
|
|
|
{password}
|
2016-05-22 13:23:40 +05:30
|
|
|
);
|
|
|
|
},
|
|
|
|
|
|
|
|
setNewEmail({
|
|
|
|
email = '',
|
|
|
|
key = ''
|
|
|
|
}) {
|
|
|
|
return request.post(
|
|
|
|
'/api/accounts/change-email/submit-new-email',
|
|
|
|
{email, key}
|
|
|
|
);
|
|
|
|
},
|
|
|
|
|
|
|
|
confirmNewEmail({key}) {
|
|
|
|
return request.post(
|
|
|
|
'/api/accounts/change-email/confirm-new-email',
|
|
|
|
{key}
|
|
|
|
);
|
2016-05-01 15:58:54 +05:30
|
|
|
}
|
|
|
|
};
|