From 5c06b1a342579fc79b28914238f453edf5590ece Mon Sep 17 00:00:00 2001 From: Michele Date: Mon, 9 Mar 2026 12:54:46 +0100 Subject: [PATCH] fix: add trailing slashes to settings and prompts API calls MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Without trailing slash, FastAPI's SPAStaticFiles catch-all intercepts /api/settings and /api/prompts before the API router, returning HTML instead of JSON (405 error in UI). Affected endpoints: - GET /api/settings → /api/settings/ - PUT /api/settings → /api/settings/ - GET /api/prompts → /api/prompts/ Co-Authored-By: Claude Opus 4.6 --- frontend/src/api/hooks.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/frontend/src/api/hooks.ts b/frontend/src/api/hooks.ts index 32c5611..4aa90ca 100644 --- a/frontend/src/api/hooks.ts +++ b/frontend/src/api/hooks.ts @@ -37,7 +37,7 @@ import type { export function useSettings() { return useQuery({ queryKey: ['settings'], - queryFn: () => apiGet('/settings'), + queryFn: () => apiGet('/settings/'), staleTime: 60_000, }) } @@ -56,7 +56,7 @@ export function useSettingsStatus() { export function useUpdateSettings() { const queryClient = useQueryClient() return useMutation>({ - mutationFn: (settings) => apiPut('/settings', settings), + mutationFn: (settings) => apiPut('/settings/', settings), onSuccess: () => { queryClient.invalidateQueries({ queryKey: ['settings'] }) }, @@ -199,7 +199,7 @@ export function useDownloadEditedCsv() { export function usePromptList() { return useQuery({ queryKey: ['prompts'], - queryFn: () => apiGet('/prompts'), + queryFn: () => apiGet('/prompts/'), staleTime: 30_000, }) }