refactor: rewrite useAuthClients with RQ

This commit is contained in:
kasia.oczkowska
2024-04-05 15:28:23 +01:00
parent 4b9ed29cc0
commit 91458f91ef
9 changed files with 54 additions and 84 deletions

View File

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