/*
* Copyright (C) 2024 Jonni Liljamo <jonni@liljamo.com>
*
* This file is licensed under GPL-3.0-or-later, see NOTICE and LICENSE for
* more information.
*/
package handlers
import (
"net/http"
"github.com/alexedwards/scs/v2"
"github.com/gin-gonic/gin"
)
// Logout returns a gin handler for the logout route.
func Logout(sm *scs.SessionManager) gin.HandlerFunc {
return func(c *gin.Context) {
sm.Destroy(c.Request.Context())
c.Redirect(http.StatusTemporaryRedirect, "/")
}
}