mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-17 13:20:31 +00:00
feat: add status & opened alert in credit & vendor.
This commit is contained in:
@@ -208,3 +208,22 @@ export function useRefundCreditNote(id, props, requestProps) {
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Mark the given credit note as opened.
|
||||
*/
|
||||
export function useOpenCreditNote(props) {
|
||||
const queryClient = useQueryClient();
|
||||
const apiRequest = useApiRequest();
|
||||
|
||||
return useMutation((id) => apiRequest.post(`sales/credit_notes/${id}/open`), {
|
||||
onSuccess: (res, id) => {
|
||||
// Common invalidate queries.
|
||||
commonInvalidateQueries(queryClient);
|
||||
|
||||
// Invalidate specific
|
||||
queryClient.invalidateQueries([t.CREDIT_NOTE, id]);
|
||||
},
|
||||
...props,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -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,
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user