mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-16 12:50:38 +00:00
fix(ReactQuery): add organization id in query keys.
This commit is contained in:
25
client/src/hooks/query/organization.js
Normal file
25
client/src/hooks/query/organization.js
Normal 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,
|
||||
},
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user