Fix admin login and CORS issues

- Update CORS configuration to allow frontend on port 3005
- Fix auth service to map email field to username for backend compatibility
- Add loading state handling in AdminLayout
- Add error boundary to dashboard route
- Fix unused parameter warning in login function

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-07-06 22:23:14 +02:00
parent 28632e8970
commit 3470120a0d
6 changed files with 34 additions and 13 deletions
+12 -1
View File
@@ -6,9 +6,20 @@ import { AdminSidebar } from './AdminSidebar';
import { AdminHeader } from './AdminHeader';
export const AdminLayout: React.FC = () => {
const { isAuthenticated } = useAdminAuth();
const { isAuthenticated, isLoading } = useAdminAuth();
const [sidebarOpen, setSidebarOpen] = useState(false);
if (isLoading) {
return (
<div className="min-h-screen bg-neutral-50 flex items-center justify-center">
<div className="text-center">
<div className="w-16 h-16 border-4 border-primary-600 border-t-transparent rounded-full animate-spin mx-auto mb-4"></div>
<p className="text-neutral-600">Loading...</p>
</div>
</div>
);
}
if (!isAuthenticated) {
return <Navigate to="/admin/login" replace />;
}