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:
@@ -4,7 +4,11 @@ import type { LoginResponse, GalleryAuthResponse } from '../types';
|
||||
export const authService = {
|
||||
// Admin authentication
|
||||
async adminLogin(credentials: { email: string; password: string }): Promise<LoginResponse> {
|
||||
const response = await api.post<LoginResponse>('/api/auth/admin/login', credentials);
|
||||
// Backend expects 'username' field, but we accept email
|
||||
const response = await api.post<LoginResponse>('/api/auth/admin/login', {
|
||||
username: credentials.email,
|
||||
password: credentials.password
|
||||
});
|
||||
|
||||
setAuthToken(response.data.token, true);
|
||||
return response.data;
|
||||
|
||||
Reference in New Issue
Block a user