Remove token from data and add to gin context
This commit is contained in:
@ -3,24 +3,16 @@ package http
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"git.javil.eu/jacob1123/budgeteer"
|
||||
"git.javil.eu/jacob1123/budgeteer/postgres"
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/google/uuid"
|
||||
)
|
||||
|
||||
type AccountData struct {
|
||||
Token budgeteer.Token
|
||||
Accounts []postgres.Account
|
||||
}
|
||||
|
||||
func (h *Handler) accounts(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 {
|
||||
@ -35,9 +27,17 @@ func (h *Handler) accounts(c *gin.Context) {
|
||||
}
|
||||
|
||||
d := AccountData{
|
||||
Token: token,
|
||||
Accounts: accounts,
|
||||
}
|
||||
|
||||
c.HTML(http.StatusOK, "accounts.html", d)
|
||||
}
|
||||
|
||||
type AdminData struct {
|
||||
}
|
||||
|
||||
func (h *Handler) admin(c *gin.Context) {
|
||||
d := AdminData{}
|
||||
|
||||
c.HTML(http.StatusOK, "accounts.html", d)
|
||||
}
|
||||
|
Reference in New Issue
Block a user