feat: add USER_ID_MIDDLEWARE constant and update AuthMiddleware to use it
This commit is contained in:
@@ -4,6 +4,7 @@ import (
|
||||
"net/http"
|
||||
"strings"
|
||||
|
||||
"wm-backend/configs/constants"
|
||||
"wm-backend/pkg/helper"
|
||||
"wm-backend/response"
|
||||
|
||||
@@ -48,7 +49,7 @@ func AuthMiddleware() gin.HandlerFunc {
|
||||
}
|
||||
|
||||
// 5. Set user_id in gin context for downstream handlers
|
||||
c.Set("user_id", userID)
|
||||
c.Set(constants.USER_ID_MIDDLEWARE, userID)
|
||||
c.Next()
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user