Pre-launch — Gluecron is in final validation. Public signups and git hosting for non-owner users open after launch review.
CodeIssuesPull RequestsActionsSecurityInsightsSettings
✨ AI
More
Blame · Line-by-line history

authStore.ts

Each line is annotated with the commit that last touched it. Click any SHA to jump to that commit and see the surrounding change.

authStore.tsBlame28 lines · 1 contributor
5c83cccClaude1import { create } from 'zustand';
2
3export interface AuthUser {
4 id: number;
5 username: string;
6 email: string;
7 avatarUrl: string | null;
8 bio: string | null;
9 createdAt: string;
10}
11
12interface AuthState {
13 isAuthenticated: boolean;
14 user: AuthUser | null;
15 token: string | null;
16 setAuth: (user: AuthUser, token: string) => void;
17 clearAuth: () => void;
18}
19
20export const useAuthStore = create<AuthState>((set) => ({
21 isAuthenticated: false,
22 user: null,
23 token: null,
24 setAuth: (user: AuthUser, token: string) =>
25 set({ isAuthenticated: true, user, token }),
26 clearAuth: () =>
27 set({ isAuthenticated: false, user: null, token: null }),
28}));