chore(build): refactor codebase for production

This commit is contained in:
shafin-r
2026-03-12 02:39:34 +06:00
parent 121cc2bf71
commit bd35f6a852
123 changed files with 3501 additions and 3254 deletions

View File

@ -16,6 +16,7 @@ interface AuthState {
registrationMessage: string | null;
login: (credentials: LoginRequest) => Promise<boolean>;
register: (credentials: RegistrationRequest) => Promise<boolean>;
fetchUser: () => Promise<void>;
logout: () => void;
clearError: () => void;
}
@ -85,6 +86,18 @@ export const useAuthStore = create<AuthState>()(
}
},
fetchUser: async () => {
const token = useAuthStore.getState().token;
if (!token) return;
try {
const user = await api.fetchUser(token);
set({ user });
} catch (error) {
console.error("Failed to refresh user:", error);
}
},
logout: () => {
set({
user: null,