From 23c331635e2bae4d68386119f959a7656132ad90 Mon Sep 17 00:00:00 2001 From: Seagyn Davis Date: Thu, 26 May 2022 15:13:29 +0200 Subject: [PATCH] remove session management here --- inertia.go | 9 +++------ middleware.go | 9 --------- 2 files changed, 3 insertions(+), 15 deletions(-) diff --git a/inertia.go b/inertia.go index 43278ff..83a61da 100644 --- a/inertia.go +++ b/inertia.go @@ -10,7 +10,6 @@ import ( "strings" "github.com/gofiber/fiber/v2" - "github.com/gofiber/fiber/v2/middleware/session" ) // Inertia type. @@ -18,19 +17,17 @@ type Inertia struct { url string rootTemplate string version string - store *session.Store sharedProps map[string]interface{} sharedFuncMap template.FuncMap templateFS fs.FS } // New function. -func New(url, rootTemplate, version string, store *session.Store) *Inertia { +func New(url, rootTemplate, version string) *Inertia { i := new(Inertia) i.url = url i.rootTemplate = rootTemplate i.version = version - i.store = store i.sharedProps = make(map[string]interface{}) i.sharedFuncMap = template.FuncMap{"marshal": marshal} @@ -38,8 +35,8 @@ func New(url, rootTemplate, version string, store *session.Store) *Inertia { } // NewWithFS function. -func NewWithFS(url, rootTemplate, version string, store *session.Store, templateFS fs.FS) *Inertia { - i := New(url, rootTemplate, version, store) +func NewWithFS(url, rootTemplate, version string, templateFS fs.FS) *Inertia { + i := New(url, rootTemplate, version) i.templateFS = templateFS return i diff --git a/middleware.go b/middleware.go index f54a92a..127646a 100644 --- a/middleware.go +++ b/middleware.go @@ -15,15 +15,6 @@ func (i *Inertia) Middleware(c *fiber.Ctx) error { return c.SendStatus(fiber.StatusConflict) } - sess, _ := i.store.Get(c) - - message := sess.Get("message") - - if message != nil { - i.Share("message", sess.Get("message")) - sess.Delete("message") - } - // Go to next middleware: return c.Next() }