diff --git a/server/src/application/getGameInfo.go b/server/src/application/getGameInfo.go index a290722..86708f6 100644 --- a/server/src/application/getGameInfo.go +++ b/server/src/application/getGameInfo.go @@ -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) diff --git a/server/src/game/struct.go b/server/src/game/struct.go index 0b972ab..27b991f 100644 --- a/server/src/game/struct.go +++ b/server/src/game/struct.go @@ -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 {