Fix deletion of web/slack/jira/confluence/... connector when creating a new one

This commit is contained in:
Weves
2023-07-18 12:00:29 -07:00
committed by Chris Weaver
parent 3b1a8274a9
commit ab37b8e8ea

View File

@@ -80,12 +80,14 @@ export function ConnectorForm<T extends Yup.AnyObject>({
validationSchema={validationSchema} validationSchema={validationSchema}
onSubmit={async (values, formikHelpers) => { onSubmit={async (values, formikHelpers) => {
formikHelpers.setSubmitting(true); formikHelpers.setSubmitting(true);
const connectorName = nameBuilder(values);
// best effort check to see if existing connector exists // best effort check to see if existing connector exists
// delete it if it does, the current assumption is that only // delete it if it does, the current assumption is that only
// one google drive connector will exist at a time // one google drive connector will exist at a time
const errorMsg = await deleteConnectorIfExists({ const errorMsg = await deleteConnectorIfExists({
source, source,
name: connectorName,
}); });
if (errorMsg) { if (errorMsg) {
setPopup({ setPopup({
@@ -96,7 +98,7 @@ export function ConnectorForm<T extends Yup.AnyObject>({
} }
const { message, isSuccess, response } = await submitConnector<T>({ const { message, isSuccess, response } = await submitConnector<T>({
name: nameBuilder(values), name: connectorName,
source, source,
input_type: inputType, input_type: inputType,
connector_specific_config: values, connector_specific_config: values,