Remove redundant getTransactions method
This commit is contained in:
parent
56bca7f0ad
commit
04b0bfb4ec
1 changed files with 3 additions and 13 deletions
|
@ -245,16 +245,6 @@ class DataStore : ObservableObject {
|
||||||
@Published var selectedTransaction: Transaction? = nil
|
@Published var selectedTransaction: Transaction? = nil
|
||||||
private var budgetId: String = ""
|
private var budgetId: String = ""
|
||||||
private var categoryId: String? = nil
|
private var categoryId: String? = nil
|
||||||
private var from: Date? = nil
|
|
||||||
private var count: Int? = nil
|
|
||||||
private var page: Int? = nil
|
|
||||||
|
|
||||||
func getTransactions(from: Date? = nil, count: Int? = nil, page: Int? = nil) async {
|
|
||||||
self.from = from
|
|
||||||
self.count = count
|
|
||||||
self.page = page
|
|
||||||
await self.getTransactions()
|
|
||||||
}
|
|
||||||
|
|
||||||
func getTransactions() async {
|
func getTransactions() async {
|
||||||
guard case let .success(budget) = self.budget else {
|
guard case let .success(budget) = self.budget else {
|
||||||
|
@ -276,10 +266,10 @@ class DataStore : ObservableObject {
|
||||||
let transactions = try await self.apiService.getTransactions(
|
let transactions = try await self.apiService.getTransactions(
|
||||||
budgetIds: [budgetId],
|
budgetIds: [budgetId],
|
||||||
categoryIds: categoryIds,
|
categoryIds: categoryIds,
|
||||||
from: from ?? Date.firstOfMonth,
|
from: Date.firstOfMonth,
|
||||||
to: nil,
|
to: nil,
|
||||||
count: count,
|
count: nil,
|
||||||
page: page
|
page: nil
|
||||||
)
|
)
|
||||||
let groupedTransactions = OrderedDictionary<String,[Transaction]>(grouping: transactions, by: { $0.date.toLocaleString() })
|
let groupedTransactions = OrderedDictionary<String,[Transaction]>(grouping: transactions, by: { $0.date.toLocaleString() })
|
||||||
self.transactions = .success(groupedTransactions)
|
self.transactions = .success(groupedTransactions)
|
||||||
|
|
Loading…
Reference in a new issue