mirror of
https://github.com/langbot-app/LangBot.git
synced 2026-06-18 11:44:18 +00:00
perf: add notification toasts
This commit is contained in:
@@ -4,6 +4,7 @@ import { httpClient } from '@/app/infra/http/HttpClient';
|
||||
import { Badge } from "@/components/ui/badge"
|
||||
import { Switch } from "@/components/ui/switch"
|
||||
import { Button } from "@/components/ui/button"
|
||||
import { toast } from "sonner"
|
||||
|
||||
export default function PluginCardComponent({
|
||||
cardVO,
|
||||
@@ -24,7 +25,7 @@ export default function PluginCardComponent({
|
||||
setEnabled(!enabled);
|
||||
})
|
||||
.catch((err) => {
|
||||
console.log('error: ', err);
|
||||
toast.error("修改失败:" + err.message);
|
||||
})
|
||||
.finally(() => {
|
||||
setSwitchEnable(true);
|
||||
|
||||
@@ -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