Skip to content

Commit

Permalink
fix: return txn when no files attached in transaction service (#3026)
Browse files Browse the repository at this point in the history
  • Loading branch information
Chethan-Fyle authored May 28, 2024
1 parent a943b4e commit 5b68550
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/app/core/services/transaction.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,11 @@ export class TransactionService {
return forkJoin([fileUploads$, upsertTxn$]).pipe(
switchMap(([fileObjs, transaction]) => {
const fileIds = fileObjs.map((fileObj) => fileObj.id);
return this.expensesService.attachReceiptsToExpense(transaction.id, fileIds).pipe(map(() => transaction));
if (fileIds.length > 0) {
return this.expensesService.attachReceiptsToExpense(transaction.id, fileIds).pipe(map(() => transaction));
} else {
return of(transaction);
}
})
);
}
Expand Down

0 comments on commit 5b68550

Please sign in to comment.