moar stuff.

This commit is contained in:
2023-09-23 14:04:13 +02:00
parent c7d3a3200e
commit 2188d489ea
48 changed files with 1684 additions and 91 deletions
+14
View File
@@ -1,3 +1,5 @@
import type { Color } from "$lib/models/color";
import type CommandInput from "$lib/models/command";
import type UIState from "$lib/models/uistate";
export default async function fetchLucifer<T>(path: string, init?: RequestInit): Promise<T> {
@@ -21,3 +23,15 @@ export async function fetchUIState(): Promise<UIState> {
return fetchLucifer("state");
}
export async function fetchColor(color: string): Promise<Color> {
return fetchLucifer("color/"+color);
}
export async function runCommand(command: CommandInput): Promise<CommandInput> {
return fetchLucifer("command", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify(command),
})
}