feat: add user management features including user creation, editing, and role management

- Implemented user API functions for fetching, creating, updating, and managing users.
- Created a UsersPage component for displaying and managing users with search and pagination.
- Added types for user data and mutation payloads.
- Introduced a LegacyRouteRedirect component for handling legacy routes.
- Defined settings-related types for better type safety in settings management.
This commit is contained in:
ryan
2026-03-11 15:40:41 +08:00
parent 13cc880f67
commit 4f8970ff5c
30 changed files with 2577 additions and 99 deletions
+7 -4
View File
@@ -17,12 +17,15 @@ export function getApiUrl(path: string) {
}
export async function apiRequest<T>(path: string, init?: RequestInit) {
const headers = new Headers(init?.headers ?? {});
if (!(init?.body instanceof FormData) && !headers.has('Content-Type')) {
headers.set('Content-Type', 'application/json');
}
const response = await fetch(getApiUrl(path), {
credentials: 'include',
headers: {
'Content-Type': 'application/json',
...(init?.headers ?? {}),
},
headers,
...init,
});