nopaque/app/static/js/Requests/users/users.js

39 lines
1.1 KiB
JavaScript
Raw Normal View History

/*****************************************************************************
* Users *
* Fetch requests for /users routes *
*****************************************************************************/
Requests.users = {};
Requests.users.entity = {};
Requests.users.entity.delete = (userId) => {
let input = `/users/${userId}`;
let init = {
method: 'DELETE'
};
return Requests.JSONfetch(input, init);
};
Requests.users.entity.settings = {};
Requests.users.entity.settings.avatar = {};
Requests.users.entity.settings.avatar.delete = (userId) => {
let input = `/users/${userId}/settings/avatar`;
let init = {
method: 'DELETE'
};
return Requests.JSONfetch(input, init);
}
Requests.users.entity.settings.profilePrivacy = {};
Requests.users.entity.settings.profilePrivacy.update = (userId, profilePrivacySetting, enabled) => {
let input = `/users/${userId}/settings/profile-privacy/${profilePrivacySetting}`;
let init = {
method: 'PUT',
body: JSON.stringify(enabled)
};
return Requests.JSONfetch(input, init);
}