From 16b704943869d1bfbd68c7840ed83392e8db565d Mon Sep 17 00:00:00 2001 From: Jan Bader Date: Tue, 15 Feb 2022 09:13:14 +0000 Subject: [PATCH] Add Transaction to list after saving --- server/transaction.go | 5 +++- web/src/components/TransactionInputRow.vue | 30 ++++++++++++---------- web/src/pages/Account.vue | 1 - web/src/stores/budget-account.ts | 15 +++++++---- 4 files changed, 30 insertions(+), 21 deletions(-) diff --git a/server/transaction.go b/server/transaction.go index 3a7bf9a..05b0595 100644 --- a/server/transaction.go +++ b/server/transaction.go @@ -68,8 +68,11 @@ func (h *Handler) newTransaction(c *gin.Context) { CategoryID: payload.Category.ID, Status: postgres.TransactionStatus(payload.State), } - _, err = h.Service.CreateTransaction(c.Request.Context(), newTransaction) + transaction, err := h.Service.CreateTransaction(c.Request.Context(), newTransaction) if err != nil { c.AbortWithError(http.StatusInternalServerError, fmt.Errorf("create transaction: %w", err)) + return } + + c.JSON(http.StatusOK, transaction) } diff --git a/web/src/components/TransactionInputRow.vue b/web/src/components/TransactionInputRow.vue index 1724dc3..d493689 100644 --- a/web/src/components/TransactionInputRow.vue +++ b/web/src/components/TransactionInputRow.vue @@ -1,7 +1,7 @@ diff --git a/web/src/pages/Account.vue b/web/src/pages/Account.vue index d38b6b1..af169bf 100644 --- a/web/src/pages/Account.vue +++ b/web/src/pages/Account.vue @@ -1,6 +1,5 @@