feat: admin interface: player's auth code

This commit is contained in:
Settel 2022-03-01 12:40:09 +01:00
parent 4f760bb5ed
commit 1e64c27918
2 changed files with 10 additions and 0 deletions

View File

@ -23,6 +23,15 @@ func (app *Application) GetGameInfo(usr *user.User, w http.ResponseWriter, r *ht
}
gameInfo := gm.GetGameInfo()
for i, _ := range gameInfo.Players {
if playerUser, err := app.GetUserById(gameInfo.Players[i].Id); err != nil {
w.WriteHeader(http.StatusInternalServerError)
fmt.Fprintf(w, "internal server error")
return
} else {
gameInfo.Players[i].AuthCode = playerUser.GetAuthCode()
}
}
w.Header().Add("Content-Type", "application/json")
jsonString, _ := json.Marshal(gameInfo)

View File

@ -87,6 +87,7 @@ type PlayerInfoJson struct {
IsPlaying bool `json:"isPlaying"`
IsIdle bool `json:"isIdle"`
NumberOfQuotes int `json:"numQuotes"`
AuthCode string `json:"authcode"`
}
type GameInfoJson struct {