feat: /api/userinfo endpoint includes lang
This commit is contained in:
parent
c624f71b7f
commit
952b4d4bcc
@ -7,6 +7,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="page-play__area">
|
<div class="page-play__area">
|
||||||
<div v-if="gameState === 'idle'" class="page-play__waiting">
|
<div v-if="gameState === 'idle'" class="page-play__waiting">
|
||||||
|
<div class="page-play__teamname">{{ teamname }}</div>
|
||||||
waiting for gamemaster to start game ...
|
waiting for gamemaster to start game ...
|
||||||
</div>
|
</div>
|
||||||
<ReadySet v-if="gameState === 'ready-set'" :text="gamePhase" />
|
<ReadySet v-if="gameState === 'ready-set'" :text="gamePhase" />
|
||||||
@ -39,6 +40,9 @@ export default {
|
|||||||
const { hash } = this.$route
|
const { hash } = this.$route
|
||||||
return hash.indexOf('debug') > -1
|
return hash.indexOf('debug') > -1
|
||||||
},
|
},
|
||||||
|
teamname() {
|
||||||
|
return this.$store.state.game.name
|
||||||
|
},
|
||||||
gameState() {
|
gameState() {
|
||||||
return this.$store.state.game.state
|
return this.$store.state.game.state
|
||||||
},
|
},
|
||||||
@ -93,6 +97,10 @@ export default {
|
|||||||
font-size: 24px;
|
font-size: 24px;
|
||||||
color: #ffffff;
|
color: #ffffff;
|
||||||
}
|
}
|
||||||
|
&__teamname {
|
||||||
|
font-size: 36px;
|
||||||
|
margin-bottom: 36px;
|
||||||
|
}
|
||||||
&__error-box {
|
&__error-box {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
left: 30%;
|
left: 30%;
|
||||||
|
@ -100,6 +100,13 @@ func (gm *Game) GetName() string {
|
|||||||
return gm.name
|
return gm.name
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (gm *Game) GetLang() string {
|
||||||
|
gm.mu.Lock()
|
||||||
|
defer gm.mu.Unlock()
|
||||||
|
|
||||||
|
return gm.lang
|
||||||
|
}
|
||||||
|
|
||||||
func (gm *Game) GetEngine() *engine.Engine {
|
func (gm *Game) GetEngine() *engine.Engine {
|
||||||
gm.mu.Lock()
|
gm.mu.Lock()
|
||||||
defer gm.mu.Unlock()
|
defer gm.mu.Unlock()
|
||||||
|
@ -10,17 +10,24 @@ import (
|
|||||||
type UserInfoJson struct {
|
type UserInfoJson struct {
|
||||||
Id string `json:"id"`
|
Id string `json:"id"`
|
||||||
Name string `json:"name"`
|
Name string `json:"name"`
|
||||||
|
Lang string `json:"lang"`
|
||||||
Role string `json:"role"`
|
Role string `json:"role"`
|
||||||
GameId string `json:"game"`
|
GameId string `json:"game"`
|
||||||
IsCameo string `json:"isCameo",omitempty`
|
IsCameo string `json:"isCameo",omitempty`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (authMux *AuthMux) GetUserInfo(usr *user.User, w http.ResponseWriter, r *http.Request) {
|
func (authMux *AuthMux) GetUserInfo(usr *user.User, w http.ResponseWriter, r *http.Request) {
|
||||||
|
gameId := usr.GetGameId()
|
||||||
|
lang := "de"
|
||||||
|
if gm, err := authMux.app.GetGameById(gameId); err == nil {
|
||||||
|
lang = gm.GetLang()
|
||||||
|
}
|
||||||
usrLight := UserInfoJson{
|
usrLight := UserInfoJson{
|
||||||
Id: usr.GetId(),
|
Id: usr.GetId(),
|
||||||
Name: usr.GetName(),
|
Name: usr.GetName(),
|
||||||
Role: usr.GetRole(),
|
Role: usr.GetRole(),
|
||||||
GameId: usr.GetGameId(),
|
Lang: lang,
|
||||||
|
GameId: gameId,
|
||||||
}
|
}
|
||||||
if usr.GetCameo() != nil {
|
if usr.GetCameo() != nil {
|
||||||
usrLight.IsCameo = "true"
|
usrLight.IsCameo = "true"
|
||||||
|
Loading…
Reference in New Issue
Block a user