feat: auth flow

This commit is contained in:
talksik
2026-02-19 20:36:08 -08:00
parent 1f249c47a6
commit 144596fcaa
16 changed files with 559 additions and 24 deletions
+23
View File
@@ -0,0 +1,23 @@
import { create } from "zustand";
const AUTH_TOKEN_KEY = "auth_token";
interface SessionState {
token: string | null;
setToken: (token: string) => void;
clearToken: () => void;
}
export const useSessionStore = create<SessionState>((set) => ({
token: localStorage.getItem(AUTH_TOKEN_KEY),
setToken: (token: string) => {
localStorage.setItem(AUTH_TOKEN_KEY, token);
set({ token });
},
clearToken: () => {
localStorage.removeItem(AUTH_TOKEN_KEY);
set({ token: null });
},
}));