Split viewer and simulation into separate apps

This commit is contained in:
2026-03-12 17:18:29 -04:00
parent 0a76c60ab1
commit 2fb90162ef
45 changed files with 1982 additions and 6600 deletions

19
apps/viewer/src/api.ts Normal file
View File

@@ -0,0 +1,19 @@
import type { WorldSnapshot } from "./contracts";
export async function fetchWorldSnapshot(signal?: AbortSignal) {
const response = await fetch("/api/world", { signal });
if (!response.ok) {
throw new Error(`World request failed with ${response.status}`);
}
return response.json() as Promise<WorldSnapshot>;
}
export async function resetWorld() {
const response = await fetch("/api/world/reset", {
method: "POST",
});
if (!response.ok) {
throw new Error(`Reset request failed with ${response.status}`);
}
return response.json() as Promise<WorldSnapshot>;
}