feat: employee management — add/delete users from Members page
- Backend: POST /api/auth/users (create user), DELETE /api/auth/users/:id (delete user, unassign tasks) - Frontend API: apiCreateUser, apiDeleteUser - MembersPage: working Add Employee modal (name/email/password/role/dept), delete button with confirmation - Only CEO/CTO/Manager roles see management controls - CSS: btn-danger, btn-danger-sm styles
This commit is contained in:
15
src/api.ts
15
src/api.ts
@@ -33,6 +33,21 @@ export async function apiFetchUsers() {
|
||||
return request('/auth/users');
|
||||
}
|
||||
|
||||
export async function apiCreateUser(data: {
|
||||
name: string; email: string; password: string; role?: string; dept?: string;
|
||||
}) {
|
||||
return request('/auth/users', {
|
||||
method: 'POST',
|
||||
body: JSON.stringify(data),
|
||||
});
|
||||
}
|
||||
|
||||
export async function apiDeleteUser(id: string) {
|
||||
return request(`/auth/users/${id}`, {
|
||||
method: 'DELETE',
|
||||
});
|
||||
}
|
||||
|
||||
// Tasks
|
||||
export async function apiFetchTasks() {
|
||||
return request('/tasks');
|
||||
|
||||
Reference in New Issue
Block a user