Both Dashboard and Event components now fully support API integration with fallback to local data sources.
| Method | Endpoint | Description |
|---|---|---|
| GET | /Event |
Fetch all events |
| GET | /Event/:id |
Fetch specific event |
| POST | /Event |
Create new event |
| PUT | /Event/:id |
Update existing event |
| DELETE | /Event/:id |
Delete event |
| POST | /subscribe |
Subscribe/Unsubscribe to event |
- ✅ API Integration: Fetches events from
/simplytix/Event - ✅ Fallback Support: Falls back to local
/events.jsonif API fails - ✅ Subscribe/Unsubscribe: Full subscription management via API
- ✅ Error Handling: Graceful error handling with user feedback
- ✅ Loading States: Visual loading indicators
- ✅ Full CRUD: Create, Read, Update, Delete via API
- ✅ API Integration: All operations use API endpoints
- ✅ Fallback Support: Falls back to local data if API fails
- ✅ Subscribe/Unsubscribe: Subscription management via API
- ✅ Error Handling: Comprehensive error handling
- ✅ Loading States: Loading indicators for all operations
npm run apinpm run dev- Visit
http://localhost:5173/dashboardto test Dashboard API integration - Visit
http://localhost:5173/eventsto test Event CRUD operations
POST /simplytix/subscribe
Content-Type: application/json
{
"eventId": 1,
"userId": "john_doe",
"isSubscribed": true // true to subscribe, false to unsubscribe
}POST /simplytix/Event
Content-Type: application/json
{
"title": "New Event",
"description": "Event description",
"date": "2024-07-01T19:00:00Z",
"location": "Event Location",
"price": 25,
"district": "Downtown",
"type": "Music",
"volunteer": "Jane Doe",
"imageUrl": "https://example.com/image.jpg"
}Both components implement comprehensive error handling:
- API Unavailable: Automatically falls back to local data
- Network Errors: Shows user-friendly error messages
- Server Errors: Graceful degradation with retry options
- Loading States: Visual feedback during API calls
- Real-time Updates: Local state updates immediately for better UX
- Optimistic UI: UI updates before API confirmation
- Visual Feedback: Loading spinners and status indicators
- Fallback System: Seamless transition between API and local data
- Error Recovery: Retry mechanisms and error reporting