Rewrite with React after AI got stuck in some obscure state errors on SolidJS
This commit is contained in:
35
ui/src/state/appState.ts
Normal file
35
ui/src/state/appState.ts
Normal file
@@ -0,0 +1,35 @@
|
||||
import { atom } from "recoil";
|
||||
import type { LokOpenHours } from "~/api";
|
||||
|
||||
export type Language = "fi" | "en";
|
||||
|
||||
export type Session = {
|
||||
email: string;
|
||||
};
|
||||
|
||||
export type Toast = {
|
||||
id: number;
|
||||
message: string;
|
||||
kind: "success" | "error";
|
||||
leaving: boolean;
|
||||
};
|
||||
|
||||
export const languageAtom = atom<Language>({
|
||||
key: "languageAtom",
|
||||
default: "en",
|
||||
});
|
||||
|
||||
export const sessionAtom = atom<Session | null>({
|
||||
key: "sessionAtom",
|
||||
default: null,
|
||||
});
|
||||
|
||||
export const openHoursAtom = atom<LokOpenHours[]>({
|
||||
key: "openHoursAtom",
|
||||
default: [],
|
||||
});
|
||||
|
||||
export const toastsAtom = atom<Toast[]>({
|
||||
key: "toastsAtom",
|
||||
default: [],
|
||||
});
|
||||
Reference in New Issue
Block a user