ui stuff from laptop

This commit is contained in:
2023-02-04 11:15:22 +01:00
parent d2b2244e2f
commit da8fd03e8a
14 changed files with 4009 additions and 67 deletions
+23
View File
@@ -0,0 +1,23 @@
import type UIState from "$lib/models/uistate";
export default async function fetchLucifer<T>(path: string, init?: RequestInit): Promise<T> {
const url = import.meta.env.VITE_LUCIFER4_BACKEND_URL + "/" + path;
console.log(url);
const res = await fetch(url, init);
if (res.status !== 200) {
if (res.headers.get("Content-Type")?.includes("application/json")) {
throw await res.json();
} else {
throw await res.text();
}
}
const json = await res.json();
return json as T;
}
export async function fetchUIState(): Promise<UIState> {
return fetchLucifer("state");
}