Public Access
feat(admin): accept, deny and pending count
This commit is contained in:
1 parent
b8f70e7578
commit
f4e69e1a94
10 files changed
+230
-38
No files matched your search
+17
-3
@@ -6,12 +6,26 @@ export const ROLES = ['USER', 'AUDITOR', 'PLATFORM_ADMIN'];
|
||||
|
||||
/**
|
||||
* GET /api/admin/users: {content, page, size, totalElements, totalPages}. PLATFORM_ADMIN only (403 otherwise).
|
||||
*
|
||||
* @param status PENDING, ACTIVE or DENIED; empty for all
|
||||
*/
|
||||
export const fetchUsers = (query, page, size, init) =>
|
||||
apiFetch(`${AUTH()}/api/admin/users?${new URLSearchParams({query, page, size})}`, init);
|
||||
export const fetchUsers = (query, status, page, size, init) =>
|
||||
apiFetch(`${AUTH()}/api/admin/users?${new URLSearchParams({query, ...(status && {status}), page, size})}`, init);
|
||||
|
||||
export const fetchPendingCount = () => apiFetch(`${AUTH()}/api/admin/users/pending-count`);
|
||||
|
||||
/**
|
||||
* 204, or 409 with code SELF_ACTION, TARGET_IS_ADMIN or ALREADY_DELETED.
|
||||
* Accept or deny a registration that waits: 204, or 409 NOT_PENDING when it is decided already.
|
||||
*/
|
||||
export const decideUser = (userId, accepted) =>
|
||||
apiFetch(`${AUTH()}/api/admin/users/${userId}/decision`, {
|
||||
method: 'PUT',
|
||||
headers: {'Content-Type': 'application/json'},
|
||||
body: JSON.stringify({accepted}),
|
||||
});
|
||||
|
||||
/**
|
||||
* 204, or 409 with code SELF_ACTION, TARGET_IS_ADMIN, ALREADY_DELETED or TARGET_IS_PENDING.
|
||||
*/
|
||||
export const setUserBlocked = (userId, blocked) =>
|
||||
apiFetch(`${AUTH()}/api/admin/users/${userId}/blocked`, {
|
||||
|
||||
Reference in new issue
Block a user