refactor: replace session key strings with consts
Some checks failed
CI / Deploy / test (pull_request) Successful in 13s
CI / Deploy / lint (pull_request) Failing after 20s
CI / Deploy / deploy (pull_request) Has been skipped

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:
Ryan Hamamura
2026-03-02 22:40:10 -10:00
parent 4faf4f73b0
commit dcf76bb773
5 changed files with 23 additions and 14 deletions

View File

@@ -266,7 +266,7 @@ func HandleSetNickname(store *connect4.Store, sm *scs.SessionManager) http.Handl
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)