feat: admin interface: player's auth code
This commit is contained in:
parent
4f760bb5ed
commit
1e64c27918
@ -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)
|
||||
|
@ -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 {
|
||||
|
Loading…
Reference in New Issue
Block a user