Files
latosa-escrima/backend/api/get_csrf.go
2025-01-29 18:09:41 +01:00

20 lines
350 B
Go

package api
import (
"fmt"
"net/http"
"fr.latosa-escrima/core"
"github.com/gorilla/csrf"
)
func HandleCSRF(w http.ResponseWriter, r *http.Request) {
token := csrf.Token(r)
fmt.Println(token)
core.JSONSuccess{
Status: core.Success,
Message: "CSRF generated.",
Data: map[string]string{"csrf": token},
}.Respond(w, http.StatusOK)
}