Self-hosted US Congress monitoring platform with AI policy briefs, bill/member/topic follows, ntfy + RSS + email notifications, alignment scoring, collections, and draft-letter generator. Authored by: Jack Levy
28 lines
573 B
TypeScript
28 lines
573 B
TypeScript
import { create } from "zustand";
|
|
import { persist } from "zustand/middleware";
|
|
|
|
interface AuthUser {
|
|
id: number;
|
|
email: string;
|
|
is_admin: boolean;
|
|
}
|
|
|
|
interface AuthState {
|
|
token: string | null;
|
|
user: AuthUser | null;
|
|
setAuth: (token: string, user: AuthUser) => void;
|
|
logout: () => void;
|
|
}
|
|
|
|
export const useAuthStore = create<AuthState>()(
|
|
persist(
|
|
(set) => ({
|
|
token: null,
|
|
user: null,
|
|
setAuth: (token, user) => set({ token, user }),
|
|
logout: () => set({ token: null, user: null }),
|
|
}),
|
|
{ name: "pocketveto-auth" }
|
|
)
|
|
);
|