getSessions

This commit is contained in:
trochas
2026-01-09 15:24:27 +01:00
parent 5ce2fe71a5
commit fce2c22fa7
3 changed files with 12 additions and 4 deletions

View File

@@ -223,7 +223,12 @@ export async function getSessionsOfUserAPI(user:Coach|Athlete){
export async function getAllSessionsAPI():Promise<Session[]>{
try {
const response = await sessionService.getAll();
return response.data;
const sessions:Session[] = [];
response.data.forEach(sessionDTO => {
sessions.push(new Session(sessionDTO));
});
return sessions;
} catch (error) {
console.error("Error fetching sessions:", error);
throw error;