front correction id number|null
This commit is contained in:
@@ -210,10 +210,14 @@ export async function getAllUserAPI(): Promise<User[]> {
|
||||
}
|
||||
}
|
||||
|
||||
export async function getCoachByIdAPI(id:number): Promise<Coach|null> {
|
||||
export async function getCoachByIdAPI(id:number|null): Promise<Coach|null> {
|
||||
try{
|
||||
const response = await coachService.getById(id);
|
||||
return new Coach(response.data);
|
||||
if(id!==null){
|
||||
const response = await coachService.getById(id);
|
||||
return new Coach(response.data);
|
||||
}
|
||||
console.error("Error fetching coach by id : id null");
|
||||
return null;
|
||||
}catch (error) {
|
||||
console.error("Error fetching coach by id:", error);
|
||||
return null;
|
||||
|
||||
Reference in New Issue
Block a user