fix: add trailing slashes to settings and prompts API calls
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 <noreply@anthropic.com>
This commit is contained in:
@@ -37,7 +37,7 @@ import type {
|
||||
export function useSettings() {
|
||||
return useQuery<Settings>({
|
||||
queryKey: ['settings'],
|
||||
queryFn: () => apiGet<Settings>('/settings'),
|
||||
queryFn: () => apiGet<Settings>('/settings/'),
|
||||
staleTime: 60_000,
|
||||
})
|
||||
}
|
||||
@@ -56,7 +56,7 @@ export function useSettingsStatus() {
|
||||
export function useUpdateSettings() {
|
||||
const queryClient = useQueryClient()
|
||||
return useMutation<Settings, Error, Partial<Settings>>({
|
||||
mutationFn: (settings) => apiPut<Settings>('/settings', settings),
|
||||
mutationFn: (settings) => apiPut<Settings>('/settings/', settings),
|
||||
onSuccess: () => {
|
||||
queryClient.invalidateQueries({ queryKey: ['settings'] })
|
||||
},
|
||||
@@ -199,7 +199,7 @@ export function useDownloadEditedCsv() {
|
||||
export function usePromptList() {
|
||||
return useQuery<PromptListResponse>({
|
||||
queryKey: ['prompts'],
|
||||
queryFn: () => apiGet<PromptListResponse>('/prompts'),
|
||||
queryFn: () => apiGet<PromptListResponse>('/prompts/'),
|
||||
staleTime: 30_000,
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user