mirror of
https://gitlab.ub.uni-bielefeld.de/sfb1288inf/nopaque.git
synced 2024-12-27 20:04:17 +00:00
46 lines
1.3 KiB
JavaScript
46 lines
1.3 KiB
JavaScript
/*****************************************************************************
|
|
* Settings *
|
|
* Fetch requests for /settings routes *
|
|
*****************************************************************************/
|
|
Requests.settings = {};
|
|
|
|
Requests.settings.entity = {};
|
|
|
|
Requests.settings.entity.delete = (userId) => {
|
|
let input = `/settings/${userId}`;
|
|
let init = {
|
|
method: 'DELETE'
|
|
};
|
|
return Requests.JSONfetch(input, init);
|
|
}
|
|
|
|
Requests.settings.entity.deleteAvatar = (userId) => {
|
|
let input = `/settings/${userId}/avatar`;
|
|
let init = {
|
|
method: 'DELETE'
|
|
};
|
|
return Requests.JSONfetch(input, init);
|
|
}
|
|
|
|
Requests.settings.entity.isPublic = {};
|
|
|
|
Requests.settings.entity.isPublic.update = (userId, isPublic) => {
|
|
let input = `/settings/${userId}/is-public`;
|
|
let init = {
|
|
method: 'PUT',
|
|
body: JSON.stringify(isPublic)
|
|
};
|
|
return Requests.JSONfetch(input, init);
|
|
};
|
|
|
|
Requests.settings.entity.profilePrivacySettings = {};
|
|
|
|
Requests.settings.entity.profilePrivacySettings.update = (userId, profilePrivacySetting, enabled) => {
|
|
let input = `/settings/${userId}/profile-privacy-settings/${profilePrivacySetting}`;
|
|
let init = {
|
|
method: 'PUT',
|
|
body: JSON.stringify(enabled)
|
|
};
|
|
return Requests.JSONfetch(input, init);
|
|
}
|