diff --git a/handlers/page_handler.go b/handlers/page_handler.go index fcd5c8f..ebaec34 100644 --- a/handlers/page_handler.go +++ b/handlers/page_handler.go @@ -4,22 +4,14 @@ package handlers import ( - "time" - "github.com/labstack/echo/v4" "github.com/sonr-io/motr/internal/ui/home" "github.com/sonr-io/motr/internal/ui/login" "github.com/sonr-io/motr/internal/ui/register" - "github.com/sonr-io/motr/middleware/kvstore" - "github.com/sonr-io/motr/middleware/session" "github.com/sonr-io/motr/pkg/render" ) func RenderHomePage(c echo.Context) error { - id := session.Unwrap(c).ID - ttl := time.Now().Add(time.Hour * 1) - ttlInt := ttl.Unix() - kvstore.Sessions().SetInt(id, int(ttlInt)) return render.Component(c, home.HomeView()) } diff --git a/middleware/session/middleware.go b/middleware/session/middleware.go index 9920db2..5b8a23a 100644 --- a/middleware/session/middleware.go +++ b/middleware/session/middleware.go @@ -19,9 +19,10 @@ type Context struct { func Middleware() echo.MiddlewareFunc { return func(next echo.HandlerFunc) echo.HandlerFunc { return func(c echo.Context) error { + id := DetermineID(c) ctx := &Context{ Context: c, - ID: DetermineID(c), + ID: id, } return next(ctx) }