From f82eee46361aff3b413f750d8f0fbf8cf4305fab Mon Sep 17 00:00:00 2001 From: Fu Diwei Date: Thu, 31 Oct 2024 14:30:16 +0800 Subject: [PATCH] refactor: clean code --- ui/src/components/certimate/DeployToWebhook.tsx | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/ui/src/components/certimate/DeployToWebhook.tsx b/ui/src/components/certimate/DeployToWebhook.tsx index 60fc027d..3f947999 100644 --- a/ui/src/components/certimate/DeployToWebhook.tsx +++ b/ui/src/components/certimate/DeployToWebhook.tsx @@ -6,31 +6,31 @@ import KVList from "./KVList"; import { type KVType } from "@/domain/domain"; const DeployToWebhook = () => { - const { config: data, setConfig: setDeploy, setErrors: setError } = useDeployEditContext(); + const { config, setConfig, setErrors } = useDeployEditContext(); useEffect(() => { - if (!data.id) { - setDeploy({ - ...data, + if (!config.id) { + setConfig({ + ...config, config: {}, }); } }, []); useEffect(() => { - setError({}); + setErrors({}); }, []); return ( <> { - const nv = produce(data, (draft) => { + const nv = produce(config, (draft) => { draft.config ??= {}; draft.config.variables = variables; }); - setDeploy(nv); + setConfig(nv); }} />