Skip to content

Commit

Permalink
get ynab categories by budget
Browse files Browse the repository at this point in the history
  • Loading branch information
whatuserever committed Feb 10, 2025
1 parent e85bc5e commit 04a8232
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions packages/main/src/backend/export/outputVendors/ynab/ynab.ts
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ export async function getYnabAccountDetails(
let categories: YnabAccountDetails['categories'];
if (doesBudgetIdExistInYnab(budgetIdToCheck)) {
console.log('Getting ynab categories');
categories = await getYnabCategories();
categories = await getYnabCategories(budgetIdToCheck);
} else {
// eslint-disable-next-line
console.warn(`Budget id ${budgetIdToCheck} doesn't exist in ynab`);
Expand Down Expand Up @@ -354,8 +354,8 @@ async function getBudgetsAndAccountsData() {
};
}

async function getYnabCategories() {
const categoriesResponse = await ynabAPI!.categories.getCategories(ynabConfig!.options.budgetId);
async function getYnabCategories(budgetId: string) {
const categoriesResponse = await ynabAPI!.categories.getCategories(budgetId);
const categories = _.flatMap(categoriesResponse.data.category_groups, (categoryGroup) => categoryGroup.categories);
const categoryNames = categories.map((category) => category.name);
return categoryNames;
Expand Down

0 comments on commit 04a8232

Please sign in to comment.