Capstone/ui/controllers/util.go

17 lines
315 B
Go
Raw Normal View History

2023-10-28 14:42:29 -04:00
package controllers
import (
"bytes"
"github.com/a-h/templ"
"github.com/gin-gonic/gin"
)
//Responds with 200ok and the rendered template
func renderTempl(c *gin.Context, tmpl templ.Component) {
buf := bytes.NewBuffer([]byte{})
tmpl.Render(c.Request.Context(), buf)
c.Data(200, "text/html", buf.Bytes())
}