Have transaction lists take category into account
Signed-off-by: Billy Brawner <billy@wbrawner.com>
This commit is contained in:
parent
bc80384a2b
commit
1da9946ecc
2 changed files with 3 additions and 3 deletions
|
@ -28,7 +28,7 @@ class DataStoreProvider {
|
|||
}
|
||||
|
||||
func transactionDataStore(_ category: Category? = nil) -> TransactionDataStore {
|
||||
return TransactionDataStore(transactionRepository)
|
||||
return TransactionDataStore(transactionRepository, category: category)
|
||||
}
|
||||
|
||||
func userDataStore() -> UserDataStore {
|
||||
|
|
|
@ -19,9 +19,9 @@ class TransactionDataStore: ObservableObject {
|
|||
func getTransactions(_ category: Category? = nil) {
|
||||
self.transactions = .failure(.loading)
|
||||
|
||||
var categoryIds: [Int]? = nil
|
||||
var categoryIds: [Int] = []
|
||||
if category != nil {
|
||||
categoryIds?.append(category!.id!)
|
||||
categoryIds.append(category!.id!)
|
||||
}
|
||||
_ = self.transactionRepository.getTransactions(categoryIds: categoryIds, from: Date(timeIntervalSince1970: 0))
|
||||
.receive(on: DispatchQueue.main)
|
||||
|
|
Loading…
Reference in a new issue