fix: remove /api/ double-prefix from all frontend API calls

Frontend api.ts baseUrl is already "/api", so paths like
"/api/cases" produced "/api/api/cases". Stripped the redundant
prefix from all component calls. Rewrite destination correctly
adds /api/ back for the Go backend.
This commit is contained in:
m
2026-03-25 16:05:50 +01:00
parent 661135d137
commit 19bea8d058
8 changed files with 18 additions and 18 deletions

View File

@@ -54,16 +54,16 @@ export function AppointmentList({ onEdit }: AppointmentListProps) {
const { data: appointments, isLoading } = useQuery({
queryKey: ["appointments"],
queryFn: () => api.get<Appointment[]>("/api/appointments"),
queryFn: () => api.get<Appointment[]>("/appointments"),
});
const { data: cases } = useQuery({
queryKey: ["cases"],
queryFn: () => api.get<{ cases: Case[]; total: number }>("/api/cases"),
queryFn: () => api.get<{ cases: Case[]; total: number }>("/cases"),
});
const deleteMutation = useMutation({
mutationFn: (id: string) => api.delete(`/api/appointments/${id}`),
mutationFn: (id: string) => api.delete(`/appointments/${id}`),
onSuccess: () => {
queryClient.invalidateQueries({ queryKey: ["appointments"] });
toast.success("Termin geloscht");