import { writable } from "svelte/store";
import { get_user, type User } from "./NovaAPI";

export const user = writable(
	null as User | null,
	(set: (value: User) => void) => {
		get_user().then((u: User) => {
			set(u)
		}).catch((err: any) => {
			alert("Could not fetch user:\n" + JSON.stringify(err))
		})
	}
)
