Add user management features to admin section

- Add ability to create new users from admin panel
- Add role dropdown (User/Admin) for each user
- Replace toggle buttons with select dropdown for role management
- Admin users can access the Admin section in settings
- Regular users see only Profile and Notifications sections

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
clucraft 2026-01-21 13:17:27 -05:00
parent f46c6ad9d4
commit 040cdb9c42
3 changed files with 200 additions and 25 deletions

View file

@ -172,6 +172,13 @@ export interface SystemSettings {
export const adminApi = {
getUsers: () => api.get<UserProfile[]>('/admin/users'),
createUser: (email: string, password: string, isAdmin: boolean) =>
api.post<{ message: string; user: UserProfile }>('/admin/users', {
email,
password,
is_admin: isAdmin,
}),
deleteUser: (id: number) => api.delete(`/admin/users/${id}`),
setUserAdmin: (id: number, isAdmin: boolean) =>