mirror of
https://github.com/usual2970/certimate.git
synced 2025-06-19 19:00:00 +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";
|
||||
|
||||
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 (
|
||||
<>
|
||||
<KVList
|
||||
variables={data?.config?.variables}
|
||||
variables={config?.config?.variables}
|
||||
onValueChange={(variables: KVType[]) => {
|
||||
const nv = produce(data, (draft) => {
|
||||
const nv = produce(config, (draft) => {
|
||||
draft.config ??= {};
|
||||
draft.config.variables = variables;
|
||||
});
|
||||
setDeploy(nv);
|
||||
setConfig(nv);
|
||||
}}
|
||||
/>
|
||||
</>
|
||||
|
Loading…
x
Reference in New Issue
Block a user