feat: add heats frontend API and HeatsBanner component
- Add divisionsAPI, competitionTypesAPI, heatsAPI to frontend services - Create HeatsBanner component for declaring competition heats - Support dynamic heat entry (add/remove heats) - Validate required fields (competition type, division, heat number) - Optional role selection (Leader/Follower) - Real-time API integration with backend
This commit is contained in:
@@ -220,4 +220,48 @@ export const eventsAPI = {
|
||||
},
|
||||
};
|
||||
|
||||
// Divisions API (Phase 1.6)
|
||||
export const divisionsAPI = {
|
||||
async getAll() {
|
||||
const data = await fetchAPI('/divisions');
|
||||
return data.data;
|
||||
},
|
||||
};
|
||||
|
||||
// Competition Types API (Phase 1.6)
|
||||
export const competitionTypesAPI = {
|
||||
async getAll() {
|
||||
const data = await fetchAPI('/competition-types');
|
||||
return data.data;
|
||||
},
|
||||
};
|
||||
|
||||
// Heats API (Phase 1.6)
|
||||
export const heatsAPI = {
|
||||
async saveHeats(slug, heats) {
|
||||
const data = await fetchAPI(`/events/${slug}/heats`, {
|
||||
method: 'POST',
|
||||
body: JSON.stringify({ heats }),
|
||||
});
|
||||
return data;
|
||||
},
|
||||
|
||||
async getMyHeats(slug) {
|
||||
const data = await fetchAPI(`/events/${slug}/heats/me`);
|
||||
return data.data;
|
||||
},
|
||||
|
||||
async getAllHeats(slug) {
|
||||
const data = await fetchAPI(`/events/${slug}/heats/all`);
|
||||
return data.data;
|
||||
},
|
||||
|
||||
async deleteHeat(slug, heatId) {
|
||||
const data = await fetchAPI(`/events/${slug}/heats/${heatId}`, {
|
||||
method: 'DELETE',
|
||||
});
|
||||
return data;
|
||||
},
|
||||
};
|
||||
|
||||
export { ApiError };
|
||||
|
||||
Reference in New Issue
Block a user