mirror of
https://github.com/usual2970/certimate.git
synced 2025-06-20 03:09:54 +00:00
refactor: clean code
This commit is contained in:
parent
260cfb96ec
commit
f82eee4636
@ -6,31 +6,31 @@ import KVList from "./KVList";
|
|||||||
import { type KVType } from "@/domain/domain";
|
import { type KVType } from "@/domain/domain";
|
||||||
|
|
||||||
const DeployToWebhook = () => {
|
const DeployToWebhook = () => {
|
||||||
const { config: data, setConfig: setDeploy, setErrors: setError } = useDeployEditContext();
|
const { config, setConfig, setErrors } = useDeployEditContext();
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!data.id) {
|
if (!config.id) {
|
||||||
setDeploy({
|
setConfig({
|
||||||
...data,
|
...config,
|
||||||
config: {},
|
config: {},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
setError({});
|
setErrors({});
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<KVList
|
<KVList
|
||||||
variables={data?.config?.variables}
|
variables={config?.config?.variables}
|
||||||
onValueChange={(variables: KVType[]) => {
|
onValueChange={(variables: KVType[]) => {
|
||||||
const nv = produce(data, (draft) => {
|
const nv = produce(config, (draft) => {
|
||||||
draft.config ??= {};
|
draft.config ??= {};
|
||||||
draft.config.variables = variables;
|
draft.config.variables = variables;
|
||||||
});
|
});
|
||||||
setDeploy(nv);
|
setConfig(nv);
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
</>
|
</>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user