2023-03-30 11:36:11 +00:00
|
|
|
/*****************************************************************************
|
|
|
|
* Users *
|
|
|
|
* Fetch requests for /users routes *
|
|
|
|
*****************************************************************************/
|
|
|
|
Requests.users = {};
|
|
|
|
|
|
|
|
Requests.users.entity = {};
|
|
|
|
|
2023-04-03 13:25:55 +00:00
|
|
|
Requests.users.entity.delete = (userId) => {
|
2023-03-30 11:36:11 +00:00
|
|
|
let input = `/users/${userId}`;
|
|
|
|
let init = {
|
|
|
|
method: 'DELETE'
|
|
|
|
};
|
|
|
|
return Requests.JSONfetch(input, init);
|
|
|
|
};
|
2023-04-03 13:25:55 +00:00
|
|
|
|
|
|
|
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);
|
|
|
|
}
|