fix: check save result in handleSaveAll and add slate to validColors (#4823)
Signed-off-by: Micah-Zheng <102610064+Micah-Zheng@users.noreply.github.com>
This commit is contained in:
@@ -17,7 +17,7 @@ var (
|
|||||||
"blue": true, "green": true, "cyan": true, "purple": true, "pink": true,
|
"blue": true, "green": true, "cyan": true, "purple": true, "pink": true,
|
||||||
"red": true, "orange": true, "amber": true, "yellow": true, "lime": true,
|
"red": true, "orange": true, "amber": true, "yellow": true, "lime": true,
|
||||||
"light-green": true, "teal": true, "light-blue": true, "indigo": true,
|
"light-green": true, "teal": true, "light-blue": true, "indigo": true,
|
||||||
"violet": true, "grey": true,
|
"violet": true, "grey": true, "slate": true,
|
||||||
}
|
}
|
||||||
slugRegex = regexp.MustCompile(`^[a-zA-Z0-9_-]+$`)
|
slugRegex = regexp.MustCompile(`^[a-zA-Z0-9_-]+$`)
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -250,12 +250,13 @@ export function ApiInfoSection({ enabled, data }: ApiInfoSectionProps) {
|
|||||||
|
|
||||||
const handleSaveAll = async () => {
|
const handleSaveAll = async () => {
|
||||||
try {
|
try {
|
||||||
await updateOption.mutateAsync({
|
const result = await updateOption.mutateAsync({
|
||||||
key: 'console_setting.api_info',
|
key: 'console_setting.api_info',
|
||||||
value: JSON.stringify(apiInfoList),
|
value: JSON.stringify(apiInfoList),
|
||||||
})
|
})
|
||||||
|
if (result.success) {
|
||||||
setHasChanges(false)
|
setHasChanges(false)
|
||||||
toast.success(t('API info saved successfully'))
|
}
|
||||||
} catch {
|
} catch {
|
||||||
toast.error(t('Failed to save API info'))
|
toast.error(t('Failed to save API info'))
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user