cspj-application/client/src/lib/jotai.ts

18 lines
745 B
TypeScript
Raw Normal View History

2024-11-10 22:32:30 +08:00
import { atom } from "jotai";
2024-11-11 20:37:45 +08:00
// store which page the user is currently on
// no actual routing is done here,
// full page components are used render the different pages
2024-11-12 17:47:26 +08:00
// TODO: incomplete, to be updated as more pages are added
// TODO: also remove testing when done
export type Routes = "home" | "sql_injection" | "xss" | "cmd_injection" | "testing";
export const routeAtom = atom<Routes>("home");
2024-11-11 20:37:45 +08:00
// store the status of connection to backend
type ServerConnection = "connected" | "connecting" | "disconnected";
export const serverConnectionAtom = atom<ServerConnection>("disconnected");
// store the url of the backend server
2025-01-14 03:50:45 +08:00
// TODO: let user enter their own backend server url
export const serverUrlAtom = atom("http://localhost:5000");