0
Fork 0
mirror of https://github.com/logto-io/logto.git synced 2025-01-06 20:40:08 -05:00

fix(console): should not display unsaved changes alert on connector config updated (#1685)

This commit is contained in:
Xiao Yijun 2022-07-27 10:33:46 +08:00 committed by GitHub
parent 61177ca2a1
commit 61b65a7288
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -30,6 +30,7 @@ const ConnectorContent = ({ isDeleted, connectorData, onConnectorUpdated }: Prop
formState: { isSubmitting, isDirty },
handleSubmit,
watch,
reset,
} = methods;
const defaultConfig = useMemo(() => {
@ -53,11 +54,12 @@ const ConnectorContent = ({ isDeleted, connectorData, onConnectorUpdated }: Prop
return;
}
const { metadata, ...reset } = await api
const { metadata, ...rest } = await api
.patch(`/api/connectors/${connectorData.id}`, { json: { config: result.data } })
.json<Connector & { metadata: ConnectorMetadata }>();
onConnectorUpdated({ ...reset, ...metadata });
onConnectorUpdated({ ...rest, ...metadata });
reset({ configJson: JSON.stringify(result.data, null, 2) });
toast.success(t('general.saved'));
});