From 8fbdd78cb3532a6f4ccf1f843e6a360a8e230fb5 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 --- http/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, 29 insertions(+), 22 deletions(-) diff --git a/http/transaction.go b/http/transaction.go index c047e0d..bcf0618 100644 --- a/http/transaction.go +++ b/http/transaction.go @@ -71,12 +71,13 @@ func (h *Handler) newTransaction(c *gin.Context) { CategoryID: payload.Category.ID, //TODO handle new category Status: postgres.TransactionStatus(payload.State), } - _, err = h.Service.CreateTransaction(c.Request.Context(), new) + transaction, err := h.Service.CreateTransaction(c.Request.Context(), new) if err != nil { c.AbortWithError(http.StatusInternalServerError, fmt.Errorf("create transaction: %w", err)) + return } - return + c.JSON(http.StatusOK, transaction) // } /* _, delete := c.GetPostForm("delete") 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 @@