feat(useAuthenticateApp): centralize invalidating queries
This commit is contained in:
@@ -1,9 +1,7 @@
|
||||
import { useMutation, useQueryClient } from '@tanstack/react-query';
|
||||
import { useMutation } from '@tanstack/react-query';
|
||||
import api from 'helpers/api';
|
||||
|
||||
export default function useVerifyConnection() {
|
||||
const queryClient = useQueryClient();
|
||||
|
||||
const query = useMutation({
|
||||
mutationFn: async (connectionId) => {
|
||||
try {
|
||||
@@ -16,12 +14,6 @@ export default function useVerifyConnection() {
|
||||
throw new Error('Failed while verifying connection!');
|
||||
}
|
||||
},
|
||||
onSuccess: (data) => {
|
||||
const appKey = data?.data.key;
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: ['apps', appKey, 'connections'],
|
||||
});
|
||||
},
|
||||
});
|
||||
|
||||
return query;
|
||||
|
Reference in New Issue
Block a user