mirror of
https://github.com/langbot-app/LangBot.git
synced 2026-06-13 01:06:03 +00:00
perf: add notification toasts
This commit is contained in:
@@ -12,6 +12,7 @@ import {
|
||||
DialogTitle,
|
||||
DialogFooter,
|
||||
} from "@/components/ui/dialog";
|
||||
import { toast } from "sonner";
|
||||
|
||||
enum PluginRemoveStatus {
|
||||
WAIT_INPUT = 'WAIT_INPUT',
|
||||
@@ -51,14 +52,14 @@ export default function PluginForm({
|
||||
|
||||
const handleSubmit = async (values: object) => {
|
||||
setIsLoading(true);
|
||||
try {
|
||||
await httpClient.updatePluginConfig(pluginAuthor, pluginName, values);
|
||||
onFormSubmit();
|
||||
} catch (error) {
|
||||
console.error('更新插件配置失败:', error);
|
||||
} finally {
|
||||
setIsLoading(false);
|
||||
}
|
||||
httpClient.updatePluginConfig(pluginAuthor, pluginName, values).then(() => {
|
||||
onFormSubmit();
|
||||
toast.success("保存成功");
|
||||
}).catch((error) => {
|
||||
toast.error("保存失败:" + error.message);
|
||||
}).finally(() => {
|
||||
setIsLoading(false);
|
||||
});
|
||||
};
|
||||
|
||||
if (!pluginInfo || !pluginConfig) {
|
||||
|
||||
Reference in New Issue
Block a user