import { create } from 'zustand'; import type { User } from '@shop/types'; interface AuthStore { user: User | null; isLoading: boolean; error: string | null; setUser: (user: User | null) => void; setIsLoading: (loading: boolean) => void; setError: (error: string | null) => void; logout: () => void; } /** * Zustand store for authentication state * Manages current user, loading state, and errors */ export const useAuthStore = create((set) => ({ user: null, isLoading: true, error: null, setUser: (user) => set({ user, isLoading: false }), setIsLoading: (loading) => set({ isLoading: loading }), setError: (error) => set({ error, isLoading: false }), logout: () => set({ user: null, error: null }), }));