getSessions
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user