refactor(web): rewrite useAdminAppAuthClient with react-query (#1690)
This commit is contained in:
17
packages/web/src/hooks/useAdminAppAuthClient.ee.js
Normal file
17
packages/web/src/hooks/useAdminAppAuthClient.ee.js
Normal file
@@ -0,0 +1,17 @@
|
||||
import { useQuery } from '@tanstack/react-query';
|
||||
|
||||
import api from 'helpers/api';
|
||||
|
||||
export default function useAdminAppAuthClient(id) {
|
||||
const query = useQuery({
|
||||
queryKey: ['adminAppAuthClient', id],
|
||||
queryFn: async ({ payload, signal }) => {
|
||||
const { data } = await api.get(`/v1/admin/app-auth-clients/${id}`);
|
||||
|
||||
return data;
|
||||
},
|
||||
enabled: !!id,
|
||||
});
|
||||
|
||||
return query;
|
||||
}
|
Reference in New Issue
Block a user