Skip to content

Commit

Permalink
Check and use response of connection saving
Browse files Browse the repository at this point in the history
  • Loading branch information
emilys314 committed Nov 11, 2024
1 parent e85d7a1 commit aaf5a3c
Showing 1 changed file with 8 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import { Connection, ConnectionTypeConfigMapObj } from '~/concepts/connectionTyp
import {
filterEnabledConnectionTypes,
getConnectionTypeDisplayName,
isConnection,
} from '~/concepts/connectionTypes/utils';
import { useWatchConnectionTypes } from '~/utilities/useWatchConnectionTypes';
import { useNotebooksStates } from '~/pages/projects/notebook/useNotebooksStates';
Expand Down Expand Up @@ -264,12 +265,14 @@ export const ConnectionsFormSection: React.FC<Props> = ({
refreshProjectConnections();
}
}}
onSubmit={(connection: Connection) => {
if (manageConnectionModal.isEdit) {
return replaceSecret(connection);
onSubmit={async (connection: Connection) => {
const response = manageConnectionModal.isEdit
? await replaceSecret(connection)
: await createSecret(connection);
if (isConnection(response)) {
setSelectedConnections([...selectedConnections, response]);

Check warning on line 273 in frontend/src/pages/projects/screens/spawner/connections/ConnectionsFormSection.tsx

View check run for this annotation

Codecov / codecov/patch

frontend/src/pages/projects/screens/spawner/connections/ConnectionsFormSection.tsx#L270-L273

Added lines #L270 - L273 were not covered by tests
}
setSelectedConnections([...selectedConnections, connection]);
return createSecret(connection);
return response;

Check warning on line 275 in frontend/src/pages/projects/screens/spawner/connections/ConnectionsFormSection.tsx

View check run for this annotation

Codecov / codecov/patch

frontend/src/pages/projects/screens/spawner/connections/ConnectionsFormSection.tsx#L275

Added line #L275 was not covered by tests
}}
isEdit={manageConnectionModal.isEdit}
/>
Expand Down

0 comments on commit aaf5a3c

Please sign in to comment.