feat(ui): new layout added queries

This commit is contained in:
akhilmhdh
2023-02-10 22:03:57 +05:30
parent 081ef94399
commit 52a6fe64a7
14 changed files with 195 additions and 3 deletions
@@ -0,0 +1,18 @@
import { useQuery } from '@tanstack/react-query';
import { apiRequest } from '@app/config/request';
import { Organization } from './types';
const organizationKeys = {
getUserOrganization: ['organization'] as const
};
const fetchUserOrganization = async () => {
const { data } = await apiRequest.get<{ organizations: Organization[] }>('/api/v1/organization');
return data.organizations;
};
export const useGetOrganization = () =>
useQuery({ queryKey: organizationKeys.getUserOrganization, queryFn: fetchUserOrganization });