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,23 +1,22 @@
import { toast } from 'vue-sonner';
import type { DirectoryEntry } from '#shared/types';
import type { ApiResponse } from '#shared/types/api';
import type { Warren } from '#shared/types/warrens';
import type { WarrenData } from '#shared/types/warrens';
import { getApiHeaders, getAuthHeader } from '.';
export async function getWarrens(): Promise<Record<string, Warren>> {
const { data, error } = await useFetch<ApiResponse<{ warrens: Warren[] }>>(
getApiUrl('warrens'),
{
method: 'GET',
headers: getApiHeaders(),
}
);
export async function getWarrens(): Promise<Record<string, WarrenData>> {
const { data, error } = await useFetch<
ApiResponse<{ warrens: WarrenData[] }>
>(getApiUrl('warrens'), {
method: 'GET',
headers: getApiHeaders(),
});
if (data.value == null) {
throw error.value?.name;
}
const warrens: Record<string, Warren> = {};
const warrens: Record<string, WarrenData> = {};
for (const warren of data.value.data.warrens) {
warrens[warren.id] = warren;