2023-03-30 13:36:11 +02:00
|
|
|
/*****************************************************************************
|
|
|
|
* Users *
|
|
|
|
* Fetch requests for /users routes *
|
|
|
|
*****************************************************************************/
|
2023-11-09 14:29:01 +01:00
|
|
|
nopaque.requests.users = {};
|
2023-03-30 13:36:11 +02:00
|
|
|
|
2023-11-09 14:29:01 +01:00
|
|
|
nopaque.requests.users.entity = {};
|
2023-03-30 13:36:11 +02:00
|
|
|
|
2023-11-09 14:29:01 +01:00
|
|
|
nopaque.requests.users.entity.delete = (userId) => {
|
2023-03-30 13:36:11 +02:00
|
|
|
let input = `/users/${userId}`;
|
|
|
|
let init = {
|
|
|
|
method: 'DELETE'
|
|
|
|
};
|
2023-11-09 14:29:01 +01:00
|
|
|
return nopaque.requests.JSONfetch(input, init);
|
2023-03-30 13:36:11 +02:00
|
|
|
};
|
2023-04-03 15:25:55 +02:00
|
|
|
|
2023-11-09 14:29:01 +01:00
|
|
|
nopaque.requests.users.entity.acceptTermsOfUse = () => {
|
2023-04-17 09:43:12 +02:00
|
|
|
let input = `/users/accept-terms-of-use`;
|
|
|
|
let init = {
|
|
|
|
method: 'POST'
|
|
|
|
};
|
2023-11-09 14:29:01 +01:00
|
|
|
return nopaque.requests.JSONfetch(input, init);
|
2023-04-17 09:43:12 +02:00
|
|
|
};
|
|
|
|
|
2023-11-09 14:29:01 +01:00
|
|
|
nopaque.requests.users.entity.avatar = {};
|
2023-04-03 15:25:55 +02:00
|
|
|
|
2023-11-09 14:29:01 +01:00
|
|
|
nopaque.requests.users.entity.avatar.delete = (userId) => {
|
2023-04-06 08:42:21 +02:00
|
|
|
let input = `/users/${userId}/avatar`;
|
2023-04-03 15:25:55 +02:00
|
|
|
let init = {
|
|
|
|
method: 'DELETE'
|
|
|
|
};
|
2023-11-09 14:29:01 +01:00
|
|
|
return nopaque.requests.JSONfetch(input, init);
|
2023-04-03 15:25:55 +02:00
|
|
|
}
|
2023-04-17 09:43:12 +02:00
|
|
|
|
2023-10-04 12:32:27 +02:00
|
|
|
|
|
|
|
/*****************************************************************************
|
|
|
|
* Requests for /users/<entity>/settings routes *
|
|
|
|
*****************************************************************************/
|
2023-11-09 14:29:01 +01:00
|
|
|
nopaque.requests.users.entity.settings = {};
|
2023-10-04 12:32:27 +02:00
|
|
|
|
2023-11-09 14:29:01 +01:00
|
|
|
nopaque.requests.users.entity.settings.profilePrivacy = {};
|
2023-10-04 12:32:27 +02:00
|
|
|
|
2023-11-09 14:29:01 +01:00
|
|
|
nopaque.requests.users.entity.settings.profilePrivacy.update = (userId, profilePrivacySetting, enabled) => {
|
2023-10-04 12:32:27 +02:00
|
|
|
let input = `/users/${userId}/settings/profile-privacy/${profilePrivacySetting}`;
|
|
|
|
let init = {
|
|
|
|
method: 'PUT',
|
|
|
|
body: JSON.stringify(enabled)
|
|
|
|
};
|
2023-11-09 14:29:01 +01:00
|
|
|
return nopaque.requests.JSONfetch(input, init);
|
2023-10-04 12:32:27 +02:00
|
|
|
};
|
|
|
|
|