Move the last bits of the settings package to the user package

This commit is contained in:
Patrick Jentsch
2023-04-06 08:42:21 +02:00
parent 6abf119c0c
commit 77fc8a42f1
7 changed files with 52 additions and 50 deletions

View File

@ -0,0 +1,16 @@
/*****************************************************************************
* Settings *
* Fetch requests for /users/<entity>/settings routes *
*****************************************************************************/
Requests.users.entity.settings = {};
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);
}

View File

@ -14,25 +14,12 @@ Requests.users.entity.delete = (userId) => {
return Requests.JSONfetch(input, init);
};
Requests.users.entity.settings = {};
Requests.users.entity.avatar = {};
Requests.users.entity.settings.avatar = {};
Requests.users.entity.settings.avatar.delete = (userId) => {
let input = `/users/${userId}/settings/avatar`;
Requests.users.entity.avatar.delete = (userId) => {
let input = `/users/${userId}/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);
}