From 92699891309ed79ca8114345557a03a15af0b2d9 Mon Sep 17 00:00:00 2001 From: tuanvu Date: Fri, 9 Jan 2026 15:23:21 +0100 Subject: [PATCH] getByID --- front_end/src/api.ts | 3 ++- front_end/src/components/test_api.tsx | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/front_end/src/api.ts b/front_end/src/api.ts index 0a57c87..b1a3816 100644 --- a/front_end/src/api.ts +++ b/front_end/src/api.ts @@ -80,7 +80,8 @@ export const coachService = { // controller doesn't declare a class-level path consistently; support both common patterns create: (data: any) => api.post(`/coach/create`, data), getAll: () => api.get(`/coach/all`), - getByKeycloakId: (id: number | string) => api.get(`/coach/${id}`), + getById: (id: number) => api.get(`/coach/${id}`), + getByKeycloakId: (keycloakId: string) => api.get(`/coach/keycloak/${keycloakId}`), update: (id: number | string, data: any) => api.put(`/coach/update/${id}`, data), delete: (id: number | string) => api.delete(`/coach/delete/${id}`), getSessionsForCoach: (coachId: number | string) => api.get(`/coach/${coachId}/session`), diff --git a/front_end/src/components/test_api.tsx b/front_end/src/components/test_api.tsx index a1c54e2..e4ed6d0 100644 --- a/front_end/src/components/test_api.tsx +++ b/front_end/src/components/test_api.tsx @@ -1,5 +1,5 @@ import { useKeycloak } from "@react-keycloak/web" -import { getAllCoach, getUsersAPI, postAdmin } from "../requetes" +import { getAllCoach } from "../requetes" import { Admin } from "../classes"; @@ -15,7 +15,7 @@ function TestAPI(){ admin.nom = "admin"; admin.email = "admin@gmail.com"; - postAdmin(admin); + //createAdminAPI(admin); } return(