feat: clean repository without any huge files
Build and Deploy / build-and-push (push) Failing after 1m20s

This commit is contained in:
AI Bot
2026-09-01 11:57:05 +05:30
commit 72f0193a8e
65 changed files with 17841 additions and 0 deletions
+73
View File
@@ -0,0 +1,73 @@
import { create } from 'zustand';
import { api } from '../lib/api';
interface UserProfile {
id: string;
email: string;
role: string;
api_credits: number;
storage_limit_mb: number;
}
interface AuthState {
user: { id: string, email: string } | null;
profile: UserProfile | null;
isLoading: boolean;
initialize: () => Promise<void>;
setSession: (token: string, profile: UserProfile) => void;
signOut: () => void;
setProfile: (profile: UserProfile) => void;
isAuthModalOpen: boolean;
openAuthModal: (mode?: 'login' | 'register') => void;
closeAuthModal: () => void;
authMode: 'login' | 'register';
}
export const useAuthStore = create<AuthState>((set) => ({
user: null,
profile: null,
isLoading: true,
isAuthModalOpen: false,
authMode: 'login',
openAuthModal: (mode = 'login') => set({ isAuthModalOpen: true, authMode: mode }),
closeAuthModal: () => set({ isAuthModalOpen: false }),
initialize: async () => {
try {
const token = localStorage.getItem('auth_token');
if (!token) {
set({ user: null, profile: null, isLoading: false });
return;
}
const { profile } = await api.getMe();
if (profile) {
set({
user: { id: profile.id, email: profile.email },
profile,
isLoading: false
});
} else {
localStorage.removeItem('auth_token');
set({ user: null, profile: null, isLoading: false });
}
} catch (error) {
console.error('Failed to initialize session:', error);
localStorage.removeItem('auth_token');
set({ user: null, profile: null, isLoading: false });
}
},
setSession: (token, profile) => {
localStorage.setItem('auth_token', token);
set({ user: { id: profile.id, email: profile.email }, profile });
},
signOut: () => {
localStorage.removeItem('auth_token');
set({ user: null, profile: null });
},
setProfile: (profile) => set({ profile }),
}));