From 0da6008e72a69dc956776dc3a5a039ce098fe0c6 Mon Sep 17 00:00:00 2001 From: jojo Date: Fri, 29 Sep 2023 17:15:01 -0300 Subject: [PATCH] :bug: chore: emailFromRequest transactions --- api/transactionhandler.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/api/transactionhandler.go b/api/transactionhandler.go index 2678025..4001f26 100644 --- a/api/transactionhandler.go +++ b/api/transactionhandler.go @@ -146,19 +146,19 @@ func (s transactionHandler) upload(w http.ResponseWriter, r *http.Request) { } func (s transactionHandler) transactions(w http.ResponseWriter, r *http.Request) { - _, claims, _ := jwtauth.FromContext(r.Context()) - if claims["email"] == nil { + email, err := emailFromRequest(r) + if err != nil { sendErr(w, http.StatusBadRequest, Error{"email_required", "email is required"}) return } - email := claims["email"].(string) - tResponse, err := s.storage.Transactions(r.Context(), email) + + t, err := s.storage.Transactions(r.Context(), email) if err != nil { sendErr(w, http.StatusInternalServerError, err) return } - send(w, http.StatusOK, tResponse) + send(w, http.StatusOK, t) } // Transaction represents the raw transaction from the file.