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:
Radosław Gierwiało
2025-11-14 17:34:15 +01:00
parent 265926b019
commit 37d2a7c548
2 changed files with 278 additions and 0 deletions

View File

@@ -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 };