aboutsummaryrefslogtreecommitdiff
path: root/pkg/handler/user/logout.go
diff options
context:
space:
mode:
Diffstat (limited to 'pkg/handler/user/logout.go')
-rw-r--r--pkg/handler/user/logout.go18
1 files changed, 18 insertions, 0 deletions
diff --git a/pkg/handler/user/logout.go b/pkg/handler/user/logout.go
new file mode 100644
index 0000000..9b7ea5f
--- /dev/null
+++ b/pkg/handler/user/logout.go
@@ -0,0 +1,18 @@
+package user
+
+import (
+ "net/http"
+
+ "github.com/labstack/echo/v4"
+ "go.neonxp.ru/framework/pkg/utils"
+)
+
+func (*Handler) Logout(c echo.Context) error {
+ if err := utils.SetUser(c, nil, -1); err != nil {
+ return err
+ }
+
+ utils.HTMXRedirect(c, "/")
+
+ return c.NoContent(http.StatusNoContent)
+}