refactor: replace session key strings with consts
Define KeyPlayerID, KeyUserID, and KeyNickname in the sessions package and use them across all handlers to avoid duplicated magic strings.
This commit is contained in:
@@ -277,7 +277,7 @@ func HandleSetNickname(snakeStore *snake.SnakeStore, sm *scs.SessionManager) htt
|
||||
return
|
||||
}
|
||||
|
||||
sm.Put(r.Context(), "nickname", signals.Nickname)
|
||||
sm.Put(r.Context(), sessions.KeyNickname, signals.Nickname)
|
||||
|
||||
playerID := sessions.GetPlayerID(sm, r)
|
||||
userID := sessions.GetUserID(sm, r)
|
||||
|
||||
Reference in New Issue
Block a user