feat: Inventory adjustment publish.

This commit is contained in:
elforjani3
2021-08-06 17:09:42 +02:00
parent 34377c8e53
commit 7d07238c6a
7 changed files with 121 additions and 11 deletions

View File

@@ -84,3 +84,24 @@ export function useInventoryAdjustments(query, props) {
},
);
}
/**
* Publishes the given inventory adjustment.
*/
export function usePublishInventoryAdjustment(props) {
const queryClient = useQueryClient();
const apiRequest = useApiRequest();
return useMutation(
(id) => apiRequest.post(`inventory_adjustments/${id}/publish`),
{
onSuccess: (res, id) => {
// Invalidate specific inventory adjustment.
queryClient.invalidateQueries([t.INVENTORY_ADJUSTMENT, id]);
commonInvalidateQueries(queryClient);
},
...props,
},
);
}

View File

@@ -60,6 +60,7 @@ const SALE_RECEIPTS = {
const INVENTORY_ADJUSTMENTS = {
INVENTORY_ADJUSTMENTS: 'INVENTORY_ADJUSTMENTS',
INVENTORY_ADJUSTMENT: 'INVENTORY_ADJUSTMENT',
};
const CURRENCIES = {