feat: add useAppAuth with RQ
This commit is contained in:
19
packages/web/src/hooks/useAppAuth.js
Normal file
19
packages/web/src/hooks/useAppAuth.js
Normal file
@@ -0,0 +1,19 @@
|
||||
import { useQuery } from '@tanstack/react-query';
|
||||
|
||||
import api from 'helpers/api';
|
||||
|
||||
export default function useAppAuth(appKey) {
|
||||
const query = useQuery({
|
||||
queryKey: ['appAuth', appKey],
|
||||
queryFn: async ({ payload, signal }) => {
|
||||
const { data } = await api.get(`/v1/apps/${appKey}/auth`, {
|
||||
signal,
|
||||
});
|
||||
|
||||
return data;
|
||||
},
|
||||
enabled: !!appKey,
|
||||
});
|
||||
|
||||
return query;
|
||||
}
|
Reference in New Issue
Block a user