Added HTMX partial support template rendering.

This commit is contained in:
mikestefanello 2021-12-23 17:09:44 -05:00
parent f115fcb602
commit b2f64b62f4
7 changed files with 126 additions and 60 deletions

View file

@ -6,6 +6,7 @@ import (
"time"
"goweb/context"
"goweb/htmx"
"goweb/msg"
echomw "github.com/labstack/echo/v4/middleware"
@ -94,6 +95,11 @@ type Page struct {
// This will only be populated if the request ID middleware is in effect for the given request.
RequestID string
HTMX struct {
Request htmx.Request
Response *htmx.Response
}
// Cache stores values for caching the response of this page
Cache struct {
// Enabled dictates if the response of this page should be cached.
@ -133,6 +139,8 @@ func NewPage(ctx echo.Context) Page {
p.IsAuth = true
}
p.HTMX.Request = htmx.GetRequest(ctx)
return p
}