fix(ReactQuery): add organization id in query keys.

This commit is contained in:
a.bouhuolia
2021-03-15 11:55:38 +02:00
parent 2e3fd64e2b
commit f1cf02c9df
27 changed files with 140 additions and 76 deletions

View File

@@ -0,0 +1,25 @@
import t from 'store/types';
import useApiRequest from '../useRequest';
import { useQueryTenant } from '../useQueryTenant';
/**
* Retrieve the contact duplicate.
*/
export function useOrganizations(props) {
const apiRequest = useApiRequest();
return useQueryTenant(
[t.ORGANIZATIONS],
() => apiRequest.get(`organization/all`),
{
select: (res) => res.data.organizations,
initialDataUpdatedAt: 0,
initialData: {
data: {
organizations: [],
},
},
...props,
},
);
}