MichaelEdou
Initial commit — ICC Interac Manager full-stack app
149698e
import { create } from 'zustand';
interface User {
id: string;
email: string;
name: string;
avatarUrl?: string;
role: 'admin' | 'editor' | 'viewer';
}
interface AuthState {
user: User | null;
isAuthenticated: boolean;
isLoading: boolean;
setUser: (user: User | null) => void;
setLoading: (loading: boolean) => void;
logout: () => void;
}
export const useAuthStore = create<AuthState>((set) => ({
user: null,
isAuthenticated: false,
isLoading: true,
setUser: (user) => set({ user, isAuthenticated: !!user, isLoading: false }),
setLoading: (isLoading) => set({ isLoading }),
logout: () => set({ user: null, isAuthenticated: false, isLoading: false }),
}));