Return to transaction list after creating new transactions
This commit is contained in:
parent
5e1744f7d6
commit
bb44d813fd
1 changed files with 10 additions and 2 deletions
|
@ -354,7 +354,11 @@ class DataStore : ObservableObject {
|
||||||
} else {
|
} else {
|
||||||
savedTransaction = try await self.apiService.createRecurringTransaction(transaction)
|
savedTransaction = try await self.apiService.createRecurringTransaction(transaction)
|
||||||
}
|
}
|
||||||
|
if transaction.id != "" {
|
||||||
self.recurringTransaction = .success(savedTransaction)
|
self.recurringTransaction = .success(savedTransaction)
|
||||||
|
} else {
|
||||||
|
self.recurringTransaction = .empty
|
||||||
|
}
|
||||||
if case var .success(transactions) = self.recurringTransactions {
|
if case var .success(transactions) = self.recurringTransactions {
|
||||||
transactions = transactions.filter(withoutId: savedTransaction.id)
|
transactions = transactions.filter(withoutId: savedTransaction.id)
|
||||||
transactions.append(savedTransaction)
|
transactions.append(savedTransaction)
|
||||||
|
@ -429,7 +433,11 @@ class DataStore : ObservableObject {
|
||||||
} else {
|
} else {
|
||||||
savedTransaction = try await self.apiService.createTransaction(transaction)
|
savedTransaction = try await self.apiService.createTransaction(transaction)
|
||||||
}
|
}
|
||||||
|
if transaction.id != "" {
|
||||||
self.transaction = .success(savedTransaction)
|
self.transaction = .success(savedTransaction)
|
||||||
|
} else {
|
||||||
|
self.transaction = .empty
|
||||||
|
}
|
||||||
await getTransactions()
|
await getTransactions()
|
||||||
} catch {
|
} catch {
|
||||||
self.transaction = .error(error, transaction)
|
self.transaction = .error(error, transaction)
|
||||||
|
|
Loading…
Reference in a new issue