mirror of
https://github.com/sonr-io/sonr.git
synced 2026-08-04 10:21:40 +00:00
refactor: move session management to dedicated database module
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
package session
|
||||
package context
|
||||
|
||||
import (
|
||||
"regexp"
|
||||
@@ -1,4 +1,4 @@
|
||||
package session
|
||||
package context
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
@@ -1,4 +1,4 @@
|
||||
package session
|
||||
package context
|
||||
|
||||
import (
|
||||
"github.com/labstack/echo/v4"
|
||||
@@ -6,6 +6,6 @@ import (
|
||||
"github.com/labstack/echo/v4"
|
||||
)
|
||||
|
||||
func HandleDash(c echo.Context) error {
|
||||
func Handler(c echo.Context) error {
|
||||
return c.Render(http.StatusOK, "index.templ", nil)
|
||||
}
|
||||
|
||||
@@ -7,10 +7,12 @@ import (
|
||||
session "github.com/onsonr/sonr/internal/vault/session"
|
||||
)
|
||||
|
||||
func HandleIndex(c echo.Context) error {
|
||||
func Handler(c echo.Context) error {
|
||||
// TODO: Create views
|
||||
if isInitial(c) {
|
||||
// return response.TemplEcho(c, index.InitialView())
|
||||
}
|
||||
// TODO: Add authorization check
|
||||
if isExpired(c) {
|
||||
// return response.TemplEcho(c, index.ReturningView())
|
||||
}
|
||||
|
||||
@@ -7,11 +7,11 @@ package vault
|
||||
import (
|
||||
"github.com/labstack/echo/v4"
|
||||
|
||||
session "github.com/onsonr/sonr/internal/vault/session"
|
||||
"github.com/onsonr/sonr/internal/vault/context"
|
||||
"github.com/onsonr/sonr/internal/vault/types"
|
||||
)
|
||||
|
||||
// RegisterRoutes registers the Decentralized Web Node API routes.
|
||||
func RegisterRoutes(e *echo.Echo, config *types.Config) {
|
||||
e.Use(session.Middleware(config))
|
||||
e.Use(context.Middleware(config))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user