Total Lines | 20 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | package handlers |
||
2 | |||
3 | import ( |
||
4 | "github.com/a-h/templ" |
||
5 | "github.com/labstack/echo/v4" |
||
6 | "github.com/memnix/memnix-rest/domain" |
||
7 | ) |
||
8 | |||
9 | func Render(c echo.Context, _ int, t templ.Component) error { |
||
10 | c.Response().Writer.Header().Set(echo.HeaderContentType, echo.MIMETextHTML) |
||
11 | return t.Render(c.Request().Context(), c.Response()) |
||
12 | } |
||
13 | |||
14 | func Redirect(c echo.Context, path string, statusCode int) error { |
||
15 | c.Response().Header().Set("HX-Redirect", path) |
||
16 | return c.NoContent(statusCode) |
||
17 | } |
||
18 | |||
19 | func GetNonce(c echo.Context) domain.Nonce { |
||
20 | return c.Get("nonce").(domain.Nonce) |
||
21 | } |
||
22 |