refactor: rewrite get app connections with RQ

This commit is contained in:
Rıdvan Akca
2024-04-05 15:44:23 +02:00
parent d74af4931e
commit d4e4d95b6d
8 changed files with 37 additions and 81 deletions

View File

@@ -0,0 +1,19 @@
import { useQuery } from '@tanstack/react-query';
import api from 'helpers/api';
export default function useAppConnections(appKey) {
const query = useQuery({
queryKey: ['appConnections', appKey],
queryFn: async ({ signal }) => {
const { data } = await api.get(`/v1/apps/${appKey}/connections`, {
signal,
});
return data;
},
enabled: !!appKey,
});
return query;
}