Add frontend components: dashboard, accounts, auth callback, and modal forms

Co-authored-by: christianlouis <361235+christianlouis@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot]
2026-02-01 14:07:56 +00:00
parent dfe5af1898
commit f26ab702de
28 changed files with 8522 additions and 0 deletions
+48
View File
@@ -0,0 +1,48 @@
'use client';
import { useEffect } from 'react';
import { useRouter } from 'next/navigation';
import { useAuthStore } from '@/store/authStore';
import { userApi } from '@/lib/api';
export function AuthGuard({ children }: { children: React.ReactNode }) {
const router = useRouter();
const { user, setUser, setLoading, isLoading } = useAuthStore();
useEffect(() => {
const checkAuth = async () => {
const token = localStorage.getItem('access_token');
if (!token) {
setLoading(false);
router.push('/login');
return;
}
try {
const userData = await userApi.getCurrentUser();
setUser(userData);
} catch (error) {
console.error('Auth check failed:', error);
setUser(null);
router.push('/login');
}
};
checkAuth();
}, [router, setUser, setLoading]);
if (isLoading) {
return (
<div className="min-h-screen flex items-center justify-center">
<div className="animate-spin rounded-full h-12 w-12 border-b-2 border-blue-600"></div>
</div>
);
}
if (!user) {
return null;
}
return <>{children}</>;
}