MCPcopy Create free account
hub / github.com/MaterializeInc/materialize / onSubmit

Function onSubmit

console/src/components/SecretSelectionControl.tsx:96–118  ·  view source on GitHub ↗
(formData: SecretFormState)

Source from the content-addressed store, hash-verified

94 const { mutate, isPending: isCreationInFlight } = useCreateSecret();
95
96 const onSubmit = async (formData: SecretFormState) => {
97 setGeneralFormError(null);
98 const params = {
99 name: formData.name,
100 value: formData.value,
101 databaseName: schema.databaseName,
102 schemaName: schema.name,
103 };
104 mutate(params, {
105 onSuccess: () => {
106 onClose(formData.name);
107 reset();
108 },
109 onError: (error) => {
110 if (alreadyExistsError(error.message)) {
111 setError("name", { message: capitalizeSentence(error.message) });
112 setFocus("name");
113 } else {
114 setGeneralFormError(error.message);
115 }
116 },
117 });
118 };
119
120 return (
121 <Modal isOpen={isOpen} onClose={onClose}>

Callers 3

DateRangeInputFunction · 0.85
FilterMenuFunction · 0.85
handleValidSubmitFunction · 0.85

Calls 5

alreadyExistsErrorFunction · 0.90
capitalizeSentenceFunction · 0.90
mutateFunction · 0.85
resetFunction · 0.85
onCloseFunction · 0.70

Tested by

no test coverage detected