Remove token from data and add to gin context
This commit is contained in:
@ -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,
|
||||
}
|
||||
|
Reference in New Issue
Block a user