medol-be/utils/index.utils.go

18 lines
345 B
Go
Raw Permalink Normal View History

2024-03-05 19:15:53 +00:00
package utils
import "github.com/gofiber/fiber/v2"
func IsEnabled(key bool) func(c *fiber.Ctx) bool {
if key {
return nil
}
return func(c *fiber.Ctx) bool { return true }
}
2025-04-09 21:28:46 +00:00
func CsrfErrorHandler(c *fiber.Ctx, err error) error {
return c.Status(fiber.StatusForbidden).JSON(fiber.Map{
"error": "CSRF protection: " + err.Error(),
})
}