refactor(api): migrate config-api to ApiResponse pattern

This commit is contained in:
DrSmoothl
2026-03-01 17:43:47 +08:00
parent 88e157040f
commit d4bfc9591c
9 changed files with 288 additions and 156 deletions

View File

@@ -187,6 +187,13 @@ export function useAutoSave(
const saveSection = useCallback(
async (sectionName: ConfigSectionName, sectionData: unknown) => {
try {
setAutoSaving(true)
const result = await updateBotConfigSection(sectionName, sectionData)
if (!result.success) {
throw new Error(result.error)
}
setHasUnsavedChanges(false)
onSaveSuccess?.()
setAutoSaving(true)
await updateBotConfigSection(sectionName, sectionData)
setHasUnsavedChanges(false)