Allow creating transactions without a category

This commit is contained in:
William Brawner 2021-11-30 06:05:38 -07:00
parent 0fdbdc3c3c
commit fc63684993
2 changed files with 1 additions and 4 deletions

View file

@ -62,7 +62,7 @@ struct AddTransactionView: View {
description: self.description,
date: self.date,
amount: Int(amount * 100.0),
categoryId: self.categoryId,
categoryId: self.categoryId != "" ? self.categoryId : nil,
expense: self.type == TransactionType.expense,
createdBy: self.createdBy,
budgetId: self.budgetId

View file

@ -71,9 +71,6 @@ class TransactionDataStore: ObservableObject {
func saveTransaction(_ transaction: Transaction) {
self.transaction = .failure(.loading)
// if transaction.categoryId == "" {
// transaction.categoryId = nil
// }
var transactionSavePublisher: AnyPublisher<Transaction, NetworkError>
if (transaction.id != "") {
transactionSavePublisher = self.transactionRepository.updateTransaction(transaction)