feat: add status & opened alert in credit & vendor.

This commit is contained in:
elforjani13
2021-12-06 16:28:42 +02:00
parent 2a48d9be51
commit ac99a6ca75
25 changed files with 567 additions and 222 deletions

View File

@@ -219,3 +219,25 @@ export function useRefundVendorCredit(id, props, requestProps) {
},
);
}
/**
* Mark the given vendor credit as opened.
*/
export function useOpenVendorCredit(props) {
const queryClient = useQueryClient();
const apiRequest = useApiRequest();
return useMutation(
(id) => apiRequest.post(`purchases/vendor-credit/${id}/open`),
{
onSuccess: (res, id) => {
// Common invalidate queries.
commonInvalidateQueries(queryClient);
// Invalidate specific.
queryClient.invalidateQueries([t.VENDOR_CREDIT, id]);
},
...props,
},
);
}