fix: resolve frontend API routing issues for Traefik deployment
Test and Lint / backend-test (push) Successful in 1m16s
continuous-integration/drone/push Build is failing
Test and Lint / frontend-test (push) Successful in 2m18s
Version and Release / version-bump (push) Successful in 43s
Version and Release / trigger-drone (push) Successful in 4s

Major fixes for production deployment with Traefik:

1. API Path Fixes:
   - Remove double /api prefix from all frontend service calls
   - Fix auth.service.ts to use correct paths (/auth/admin/login)
   - Update all services to use single /api prefix from base URL
   - Fix template literal paths in photo services

2. Docker Configuration:
   - Add build args for VITE_API_URL in docker-compose.prod.yml
   - Create Dockerfile.prod with proper API URL configuration
   - Ensure frontend is built with correct API base path

3. Documentation:
   - Add comprehensive TRAEFIK_DEPLOYMENT.md guide
   - Document proper Traefik labels and routing configuration
   - Include troubleshooting steps for common issues
   - Explain network configuration and SSL handling

This resolves:
- 502 Bad Gateway errors
- Double /api/api paths in requests
- Frontend unable to communicate with backend
- Login functionality not working

The frontend now correctly calls the backend API through Traefik's
routing, with all requests going to /api/* being forwarded to the
backend service on port 3000.

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

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-07-13 23:17:45 +02:00
parent 689861f671
commit ac1cd96ecd
25 changed files with 422 additions and 75 deletions
+10 -10
View File
@@ -53,36 +53,36 @@ export const eventsService = {
params.append('status', status);
}
const response = await api.get<EventsListResponse>(`/api/admin/events?${params}`);
const response = await api.get<EventsListResponse>(`/admin/events?${params}`);
return response.data;
},
// Get single event details (admin)
async getEvent(id: number): Promise<Event> {
const response = await api.get<Event>(`/api/admin/events/${id}`);
const response = await api.get<Event>(`/admin/events/${id}`);
return response.data;
},
// Create new event (admin)
async createEvent(data: CreateEventData): Promise<Event> {
const response = await api.post<Event>('/api/admin/events', data);
const response = await api.post<Event>('/admin/events', data);
return response.data;
},
// Update event (admin)
async updateEvent(id: number, data: UpdateEventData): Promise<Event> {
const response = await api.put<Event>(`/api/admin/events/${id}`, data);
const response = await api.put<Event>(`/admin/events/${id}`, data);
return response.data;
},
// Delete/deactivate event (admin)
async deleteEvent(id: number): Promise<void> {
await api.delete(`/api/admin/events/${id}`);
await api.delete(`/admin/events/${id}`);
},
// Force archive event (admin)
async archiveEvent(id: number): Promise<void> {
await api.post(`/api/admin/events/${id}/archive`);
await api.post(`/admin/events/${id}/archive`);
},
// Bulk archive events (admin)
@@ -93,7 +93,7 @@ export const eventsService = {
failed: Array<{ id: number; name: string; error: string }>;
};
}> {
const response = await api.post('/api/admin/events/bulk-archive', {
const response = await api.post('/admin/events/bulk-archive', {
eventIds,
});
return response.data;
@@ -101,7 +101,7 @@ export const eventsService = {
// Extend event expiration (admin)
async extendExpiration(id: number, days: number): Promise<Event> {
const response = await api.post<Event>(`/api/events/${id}/extend`, {
const response = await api.post<Event>(`/events/${id}/extend`, {
days,
});
return response.data;
@@ -109,13 +109,13 @@ export const eventsService = {
// Get event categories
async getEventCategories(eventId: number): Promise<Array<{ id: number; name: string; slug: string }>> {
const response = await api.get(`/api/admin/categories/event/${eventId}`);
const response = await api.get(`/admin/categories/event/${eventId}`);
return response.data || [];
},
// Reset event password
async resetPassword(eventId: number, sendEmail: boolean = true): Promise<{ message: string; newPassword: string; emailSent: boolean }> {
const response = await api.post(`/api/admin/events/${eventId}/reset-password`, { sendEmail });
const response = await api.post(`/admin/events/${eventId}/reset-password`, { sendEmail });
return response.data;
},
};