Remove token from data and add to gin context

This commit is contained in:
2021-12-02 20:04:18 +00:00
parent e7c9a7f52f
commit 36bccce021
4 changed files with 13 additions and 29 deletions

View File

@ -4,25 +4,17 @@ import (
"context"
"net/http"
"git.javil.eu/jacob1123/budgeteer"
"git.javil.eu/jacob1123/budgeteer/postgres"
"github.com/gin-gonic/gin"
"github.com/google/uuid"
)
type BudgetData struct {
Token budgeteer.Token
Budget *postgres.Budget
Transactions []postgres.Transaction
}
func (h *Handler) budget(c *gin.Context) {
token, err := h.verifyLogin(c)
if err != nil {
c.Redirect(http.StatusTemporaryRedirect, "/login")
return
}
budgetID := c.Param("budgetid")
budgetUUID, err := uuid.Parse(budgetID)
if err != nil {
@ -43,7 +35,6 @@ func (h *Handler) budget(c *gin.Context) {
}
d := BudgetData{
Token: token,
Budget: &budget,
Transactions: transactions,
}