Have transaction lists take category into account

Signed-off-by: Billy Brawner <billy@wbrawner.com>
This commit is contained in:
Billy Brawner 2019-10-07 20:54:55 -07:00
parent bc80384a2b
commit 1da9946ecc
2 changed files with 3 additions and 3 deletions

View file

@ -28,7 +28,7 @@ class DataStoreProvider {
}
func transactionDataStore(_ category: Category? = nil) -> TransactionDataStore {
return TransactionDataStore(transactionRepository)
return TransactionDataStore(transactionRepository, category: category)
}
func userDataStore() -> UserDataStore {

View file

@ -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)