cb640576f4
feat(frontend): Migrate all API routes to new structure with admin auth
...
Phase 1: Route Structure & Admin Authentication
✅ Route Prefix Fixes:
- All routes now use consistent /api prefix
- Public: /groups/* → /api/groups/*
- Admin: /groups/*, /moderation/* → /api/admin/*
- Social Media: /api/social-media/* → /api/admin/social-media/*
✅ Admin API Authentication:
- Created adminApi.js service with Bearer Token helpers
* adminFetch() - Base fetch with Authorization header
* adminGet() - GET with auto error handling
* adminRequest() - POST/PUT/PATCH/DELETE with JSON
* adminDownload() - For Blob downloads (CSV exports)
- Added frontend/.env.example with REACT_APP_ADMIN_API_KEY
- All /api/admin/* calls now use admin helpers
✅ Updated Components:
- ModerationGroupsPage.js: All admin endpoints migrated
- ModerationGroupImagesPage.js: Group loading + image deletion
- PublicGroupImagesPage.js: Fixed public group route
- DeletionLogSection.js: Deletion log endpoints
- ConsentCheckboxes.js: Platform loading
⚠️ Next Steps:
- Add user-friendly 403 error handling
- Test all affected pages
- Configure REACT_APP_ADMIN_API_KEY in deployment
2025-11-16 18:39:40 +01:00