From 65155714ae4435844c44f94cd2040560c72118e0 Mon Sep 17 00:00:00 2001 From: Renat Kalimulin Date: Fri, 3 May 2024 13:43:17 +0300 Subject: [PATCH] review fixes --- frontend/src/lib/hooks/api/kafkaConnect.ts | 24 ++++++++++------------ 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/frontend/src/lib/hooks/api/kafkaConnect.ts b/frontend/src/lib/hooks/api/kafkaConnect.ts index 6870d2f7e..599f74b2f 100644 --- a/frontend/src/lib/hooks/api/kafkaConnect.ts +++ b/frontend/src/lib/hooks/api/kafkaConnect.ts @@ -94,19 +94,18 @@ export function useConnectorTasks(props: UseConnectorProps) { } export function useUpdateConnectorState(clusterName: ClusterName) { const client = useQueryClient(); - return useMutation( - ({ + + return useMutation({ + mutationFn: ({ props, action, }: { props: UseConnectorProps; action: ConnectorAction; }) => api.updateConnectorState({ ...props, action }), - { - onSuccess: async () => - client.invalidateQueries(['clusters', clusterName, 'connectors']), - } - ); + onSuccess: () => + client.invalidateQueries(['clusters', clusterName, 'connectors']), + }); } export function useRestartConnectorTask(props: UseConnectorProps) { const client = useQueryClient(); @@ -163,10 +162,9 @@ export function useCreateConnector(clusterName: ClusterName) { export function useDeleteConnector(clusterName: ClusterName) { const client = useQueryClient(); - return useMutation( - ({ props }: { props: UseConnectorProps }) => api.deleteConnector(props), - { - onSuccess: () => client.invalidateQueries(connectorsKey(clusterName)), - } - ); + return useMutation({ + mutationFn: ({ props }: { props: UseConnectorProps }) => + api.deleteConnector(props), + onSuccess: () => client.invalidateQueries(connectorsKey(clusterName)), + }); }