feat: add superadmin management
This commit is contained in:
@@ -10,6 +10,15 @@ export interface ApiUser {
|
||||
role: ApiRole;
|
||||
}
|
||||
|
||||
export interface ManagedUser {
|
||||
id: string;
|
||||
email: string;
|
||||
name: string;
|
||||
role: ApiRole;
|
||||
isActive: boolean;
|
||||
createdAt: string;
|
||||
}
|
||||
|
||||
interface Session {
|
||||
token: string;
|
||||
user: ApiUser;
|
||||
@@ -67,3 +76,15 @@ export const authApi = {
|
||||
return apiRequest<{ user: ApiUser }>('/auth/me');
|
||||
},
|
||||
};
|
||||
|
||||
export const adminApi = {
|
||||
async listUsers() {
|
||||
return apiRequest<{ data: ManagedUser[] }>('/admin/users');
|
||||
},
|
||||
async updateUser(userId: string, update: Partial<Pick<ManagedUser, 'role' | 'isActive'>>) {
|
||||
return apiRequest<{ data: ManagedUser }>(`/admin/users/${userId}`, {
|
||||
method: 'PATCH',
|
||||
body: JSON.stringify(update),
|
||||
});
|
||||
},
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user