This commit is contained in:
trochas
2026-01-08 16:00:43 +01:00
parent 0bd93ac824
commit d68662e91c
2 changed files with 7 additions and 6 deletions

View File

@@ -2,6 +2,7 @@ import axios from "axios";
import keycloak from "./keycloak";
import { get } from "http";
import { AdminDTO, AthleteDTO, CoachDTO } from "./classesDTO";
const api = axios.create({
@@ -37,7 +38,7 @@ export function clearAuthToken() {
export const athleteService = {
// controller is mounted at /athlete
create: (data: any) => api.post("/athlete/create", data),
create: (data: any) => api.post<AthleteDTO>("/athlete/create", data),
getAll: () => api.get("/athlete/all"),
getById: (id: number | string) => api.get(`/athlete/${id}`),
getByKeycloakId: (keycloakId: string) => api.get(`/athlete/keycloak/${encodeURIComponent(keycloakId)}`),
@@ -81,7 +82,7 @@ export const sessionService = {
export const coachService = {
// controller doesn't declare a class-level path consistently; support both common patterns
create: (data: any) => api.post(`/coach/create`, data),
create: (data: any) => api.post<CoachDTO>(`/coach/create`, data),
getAll: () => api.get(`/coach/all`),
getByKeycloakId: (id: number | string) => api.get(`/coach/${id}`),
update: (id: number | string, data: any) => api.put(`/coach/update/${id}`, data),