Skip to content
Snippets Groups Projects
Unverified Commit 2b1ba889 authored by rodriguestiago0's avatar rodriguestiago0 Committed by GitHub
Browse files

Add Reset Hold and Hold For Next Month api (#3140)

parent 8be867f8
No related branches found
No related tags found
No related merge requests found
......@@ -208,3 +208,11 @@ export function updateRule(rule) {
export function deleteRule(id) {
return send('api/rule-delete', { id });
}
export function holdBudgetForNextMonth(month, amount) {
return send('api/budget-hold-for-next-month', { month, amount });
}
export function resetBudgetHold(month) {
return send('api/budget-reset-hold', { month });
}
......@@ -406,6 +406,27 @@ handlers['api/budget-set-carryover'] = withMutation(async function ({
});
});
handlers['api/budget-hold-for-next-month'] = withMutation(async function ({
month,
amount,
}) {
checkFileOpen();
await validateMonth(month);
if (amount <= 0) {
throw APIError('Amount to hold needs to be greater than 0');
}
return handlers['budget/hold-for-next-month']({
month,
amount,
});
});
handlers['api/budget-reset-hold'] = withMutation(async function ({ month }) {
checkFileOpen();
await validateMonth(month);
return handlers['budget/reset-hold']({ month });
});
handlers['api/transactions-export'] = async function ({
transactions,
categoryGroups,
......
......@@ -63,6 +63,13 @@ export interface ApiHandlers {
flag: boolean;
}) => Promise<void>;
'api/budget-hold-for-next-month': (arg: {
month: string;
amount: number;
}) => Promise<void>;
'api/budget-reset-hold': (arg: { month: string }) => Promise<void>;
'api/transactions-export': (arg: {
transactions;
categoryGroups;
......
---
category: Enhancements
authors: [rodriguestiago0]
---
Add `reset-hold` and `hold-for-next-month` methods to the API
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment