list warrens + explore nested folders

This commit is contained in:
2025-07-12 06:39:43 +02:00
parent f9f55895ed
commit 4d0765c53b
38 changed files with 1877 additions and 93 deletions

View File

@@ -0,0 +1,29 @@
import type { DirectoryEntry } from '~/types';
import type { Warren } from '~/types/warrens';
export async function getWarrens(): Promise<Record<string, Warren>> {
const arr: Warren[] = await $fetch(getApiUrl('warrens'), {
method: 'GET',
});
const warrens: Record<string, Warren> = {};
for (const warren of arr) {
warrens[warren.id] = warren;
}
return warrens;
}
export async function getWarrenDirectory(
path: string
): Promise<DirectoryEntry[]> {
const entries: DirectoryEntry[] = await $fetch(
getApiUrl(`warrens/${path}`),
{
method: 'GET',
}
);
return entries;
}