moar stuff.
This commit is contained in:
@@ -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),
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user