20 lines
350 B
Go
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)
|
|
}
|