refactor: Fix linter errors

This commit is contained in:
2025-11-04 20:04:13 +03:00
parent 2a411136b7
commit 465eb99bae
2 changed files with 18 additions and 16 deletions

View File

@@ -9,6 +9,12 @@ import (
"github.com/gin-gonic/gin"
)
type ContextKey string
const (
UserContextKey ContextKey = "user"
)
func SetUserFromJWT() gin.HandlerFunc {
return func(c *gin.Context) {
ctx := c.Request.Context()
@@ -34,7 +40,7 @@ func SetUserFromJWT() gin.HandlerFunc {
return
}
ctx = context.WithValue(ctx, "user", user)
ctx = context.WithValue(ctx, UserContextKey, user)
c.Request = c.Request.WithContext(ctx)