Completed
Push — main ( 28a13c...ee7c69 )
by Yume
24s queued 21s
created

handlers.GetNonce   A

Complexity

Conditions 1

Size

Total Lines 2
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nop 1
dl 0
loc 2
rs 10
c 0
b 0
f 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