Fix TypeScript error: type AiSettings query result explicitly
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
22fc1ce2f1
commit
b1c160f607
1 changed files with 8 additions and 4 deletions
|
|
@ -9,6 +9,7 @@ import {
|
|||
} from "@/api/auth";
|
||||
import { listBackups, triggerBackup, downloadBackup, restoreBackup } from "@/api/admin";
|
||||
import { getAiSettings, saveAiSettings, clearAiSettings } from "@/api/settings";
|
||||
import type { AiSettings } from "@/api/settings";
|
||||
import type { BackupFile } from "@/api/admin";
|
||||
import { cn } from "@/utils/cn";
|
||||
import { format } from "date-fns";
|
||||
|
|
@ -660,11 +661,14 @@ function AiSection() {
|
|||
const [showKey, setShowKey] = useState(false);
|
||||
const [success, setSuccess] = useState("");
|
||||
|
||||
const { data: current, isLoading } = useQuery({
|
||||
const { data: current, isLoading } = useQuery<AiSettings>({
|
||||
queryKey: ["ai-settings"],
|
||||
queryFn: getAiSettings,
|
||||
onSuccess: (d: any) => { if (d.provider) setProvider(d.provider); },
|
||||
} as any);
|
||||
queryFn: async () => {
|
||||
const d = await getAiSettings();
|
||||
if (d.provider) setProvider(d.provider);
|
||||
return d;
|
||||
},
|
||||
});
|
||||
|
||||
const saveMutation = useMutation({
|
||||
mutationFn: () => saveAiSettings(provider, apiKey),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue