package middleware

import (
	"github.com/gin-contrib/cors"
	"github.com/gin-gonic/gin"
)

func Cors() gin.HandlerFunc {
	corsOpts := cors.DefaultConfig()
	corsOpts.AllowCredentials = true
	corsOpts.AllowOriginFunc = func(origin string) bool { return origin != "" }

	return cors.New(corsOpts)
}
