Fix: pass username in ctx; more test words
This commit is contained in:
@ -2,6 +2,7 @@ package handlers
|
||||
|
||||
import (
|
||||
"golias/config"
|
||||
"golias/models"
|
||||
"golias/pkg/cache"
|
||||
"html/template"
|
||||
"log/slog"
|
||||
@ -35,6 +36,21 @@ var roundWords = map[string]string{
|
||||
"rat": "white",
|
||||
"perplexity": "blue",
|
||||
"notion": "red",
|
||||
"guitar": "blue",
|
||||
"ocean": "blue",
|
||||
"moon": "blue",
|
||||
"coffee": "blue",
|
||||
"mountain": "blue",
|
||||
"book": "blue",
|
||||
"camera": "blue",
|
||||
"apple": "red",
|
||||
"fire": "red",
|
||||
"rose": "red",
|
||||
"sun": "red",
|
||||
"cherry": "red",
|
||||
"heart": "red",
|
||||
"tomato": "red",
|
||||
"cloud": "white",
|
||||
}
|
||||
|
||||
func HandlePing(w http.ResponseWriter, r *http.Request) {
|
||||
@ -47,16 +63,13 @@ func HandleHome(w http.ResponseWriter, r *http.Request) {
|
||||
abortWithError(w, err.Error())
|
||||
return
|
||||
}
|
||||
// check if user in a room
|
||||
// roomID := getRoomIDFromCtx(r.Context())
|
||||
// roomID = "test-id"
|
||||
// if roomID != "" {
|
||||
// // get room data
|
||||
// userState := models.MakeTestState()
|
||||
// tmpl.ExecuteTemplate(w, "room", userState)
|
||||
// return
|
||||
// }
|
||||
// userState := models.MakeTestState()
|
||||
userState, _ := getStateByCtx(r.Context())
|
||||
if userState == nil {
|
||||
userState = &models.UserState{}
|
||||
}
|
||||
// if err != nil {
|
||||
// abortWithError(w, err.Error())
|
||||
// return
|
||||
// }
|
||||
tmpl.ExecuteTemplate(w, "base", userState)
|
||||
}
|
||||
|
Reference in New Issue
Block a user