refactor: rewrite get app connections with RQ
This commit is contained in:
19
packages/web/src/hooks/useAppConnections.js
Normal file
19
packages/web/src/hooks/useAppConnections.js
Normal 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;
|
||||
}
|
Reference in New Issue
Block a user