Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 2 additions & 10 deletions airflow-core/src/airflow/ui/src/queries/useTestConnection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,21 +16,13 @@
* specific language governing permissions and limitations
* under the License.
*/
import { useQueryClient } from "@tanstack/react-query";
import type { Dispatch, SetStateAction } from "react";

import { useConnectionServiceTestConnection, useConnectionServiceGetConnectionsKey } from "openapi/queries";
import { useConnectionServiceTestConnection } from "openapi/queries";
import type { ConnectionTestResponse } from "openapi/requests/types.gen";

export const useTestConnection = (setConnected: Dispatch<SetStateAction<boolean | undefined>>) => {
const queryClient = useQueryClient();

const onSuccess = async (res: ConnectionTestResponse) => {
await queryClient.invalidateQueries({
queryKey: [useConnectionServiceGetConnectionsKey],
});
setConnected(res.status);
};
const onSuccess = (res: ConnectionTestResponse) => setConnected(res.status);

const onError = () => {
setConnected(false);
Expand Down