Files
fnx_web/svelte/src/lib/UserStore.ts

14 lines
360 B
TypeScript
Raw Normal View History

import { writable } from "svelte/store";
2026-06-10 23:53:03 +02:00
import { get_user, type Subscription, type User } from "./NovaAPI";
export const user = writable(
{ subscription: {} as Subscription } as User,
(set: (value: User) => void) => {
get_user().then((u: User) => {
set(u)
}).catch((err: any) => {
alert("Could not fetch user:\n" + JSON.stringify(err))
})
}
)