nopaque/app/static/js/requests/users.js

52 lines
1.6 KiB
JavaScript
Raw Permalink Normal View History

/*****************************************************************************
* Users *
* Fetch requests for /users routes *
*****************************************************************************/
nopaque.requests.users = {};
nopaque.requests.users.entity = {};
nopaque.requests.users.entity.delete = (userId) => {
let input = `/users/${userId}`;
let init = {
method: 'DELETE'
};
return nopaque.requests.JSONfetch(input, init);
};
nopaque.requests.users.entity.acceptTermsOfUse = () => {
let input = `/users/accept-terms-of-use`;
let init = {
method: 'POST'
};
return nopaque.requests.JSONfetch(input, init);
};
nopaque.requests.users.entity.avatar = {};
nopaque.requests.users.entity.avatar.delete = (userId) => {
let input = `/users/${userId}/avatar`;
let init = {
method: 'DELETE'
};
return nopaque.requests.JSONfetch(input, init);
}
2023-10-04 10:32:27 +00:00
/*****************************************************************************
* Requests for /users/<entity>/settings routes *
*****************************************************************************/
nopaque.requests.users.entity.settings = {};
2023-10-04 10:32:27 +00:00
nopaque.requests.users.entity.settings.profilePrivacy = {};
2023-10-04 10:32:27 +00:00
nopaque.requests.users.entity.settings.profilePrivacy.update = (userId, profilePrivacySetting, enabled) => {
2023-10-04 10:32:27 +00:00
let input = `/users/${userId}/settings/profile-privacy/${profilePrivacySetting}`;
let init = {
method: 'PUT',
body: JSON.stringify(enabled)
};
return nopaque.requests.JSONfetch(input, init);
2023-10-04 10:32:27 +00:00
};