further clean ups

This commit is contained in:
kolaflash
2025-12-30 19:40:24 +01:00
parent 24508da335
commit 3f2ebb3291
3 changed files with 30 additions and 46 deletions
+14
View File
@@ -0,0 +1,14 @@
import type { BrowserFolder } from "#/dev/FileBrowser.tsx";
export async function fetchBrowserData(dir: string): Promise<BrowserFolder> {
const indexRef: string[] = await (await fetch(`/api/${dir}`)).json();
const scenes = indexRef.reduce((root, entry) => {
const [name] = entry.substring(1).split("/");
root.set(name, { path: name, isActive: false });
return root;
}, new Map() as BrowserFolder);
return new Map([[dir, scenes]]);
}