refactor(api): migrate config-api to ApiResponse pattern
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user