feat(branche & warehouse ) add mark primary alert.

This commit is contained in:
elforjani13
2022-02-08 20:31:15 +02:00
committed by a.bouhuolia
parent 76a15c3f4e
commit 5aae2c849d
13 changed files with 242 additions and 23 deletions

View File

@@ -113,3 +113,21 @@ export function useActivateBranches(props) {
...props,
});
}
/**
* Mark primary the given branch.
*/
export function useMarkPrimaryBranches(props) {
const queryClient = useQueryClient();
const apiRequest = useApiRequest();
return useMutation((id) => apiRequest.post(`branches/${id}/mark-primary`), {
onSuccess: (res, id) => {
// Invalidate specific inventory adjustment.
queryClient.invalidateQueries([t.BRANCH, id]);
commonInvalidateQueries(queryClient);
},
...props,
});
}

View File

@@ -233,3 +233,21 @@ export function useActivateWarehouses(props) {
...props,
});
}
/**
* Mark primary the given branch.
*/
export function useMarkPrimaryWarehouse(props) {
const queryClient = useQueryClient();
const apiRequest = useApiRequest();
return useMutation((id) => apiRequest.post(`warehouses/${id}/mark-primary`), {
onSuccess: (res, id) => {
// Invalidate specific inventory adjustment.
queryClient.invalidateQueries([t.WAREHOUSE, id]);
commonInvalidateQueries(queryClient);
},
...props,
});
}