add / edit / delete user warrens

This commit is contained in:
2025-07-21 19:27:41 +02:00
parent 50e066f794
commit 2c26002507
86 changed files with 2197 additions and 300 deletions

View File

@@ -1,5 +1,5 @@
import type { ApiResponse } from '~/shared/types/api';
import type { UserWarren, Warren } from '~/shared/types/warrens';
import type { AdminWarrenData, UserWarren } from '~/shared/types/warrens';
import { getApiHeaders } from '..';
import type { AdminResources, AuthUserWithWarrens } from '~/shared/types/admin';
import type { AuthUser } from '~/shared/types/auth';
@@ -15,7 +15,7 @@ export async function fetchAllAdminResources(): Promise<
ApiResponse<{
users: AuthUser[];
userWarrens: UserWarren[];
warrens: Warren[];
warrens: AdminWarrenData[];
}>
>(getApiUrl('admin/all'), {
method: 'GET',
@@ -36,7 +36,7 @@ export async function fetchAllAdminResources(): Promise<
warrens: [],
}))
.reduce((acc, u) => ({ ...acc, [u.id]: u }), {});
const warrens: Record<string, Warren> = {};
const warrens: Record<string, AdminWarrenData> = {};
for (const warren of data.value.data.warrens) {
warrens[warren.id] = warren;