ressourcePanel getAll

This commit is contained in:
trochas
2026-01-10 17:38:40 +01:00
parent 9aeef08e65
commit e85f76c810
3 changed files with 36 additions and 8 deletions

View File

@@ -189,6 +189,21 @@ export async function createActivityAPI(activity: Activite):Promise<Activite>{
}
}
export async function getAllActiviteAPI(): Promise<Activite[]> {
try {
const response = await activiteService.getAll();
const activites:Activite[] = []
response.data.forEach(dto => {
activites.push(new Activite(dto));
});
return activites;
} catch (error) {
console.error("Error fetching users:", error);
throw error;
}
}
export async function postAthlete(athlete: Athlete):Promise<Athlete>{
try {
const response = await api.post<Athlete>("/athlete/create/",athlete.toDTO);
@@ -319,9 +334,12 @@ export async function getAllSessionsAPI():Promise<Session[]>{
//COACH
export async function getAllCoach(): Promise<Coach[]> {
try {
const response = await api.get<Coach[]>("/coach/all");
console.log(response);
return response.data;
const response = await coachService.getAll();
const coachs:Coach[] = []
response.data.forEach(dto => {
coachs.push(new Coach(dto));
});
return coachs;
} catch (error) {
console.error("Error fetching coachs:", error);
throw error;
@@ -332,7 +350,11 @@ export async function getAllCoach(): Promise<Coach[]> {
export async function getAllAthlete(): Promise<Athlete[]> {
try {
const response = await athleteService.getAll();
return response.data;
const athletes:Athlete[] = []
response.data.forEach(dto => {
athletes.push(new Athlete(dto));
});
return athletes;
} catch (error) {
console.error("Error fetching users:", error);
throw error;