Skip to content

Commit 4e1af1a

Browse files
committed
Fetch config from server in Create… methods
1 parent a10b1fb commit 4e1af1a

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

templates/new/client/game.go.tmpl

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,11 @@ func CreateAndJoinGame(public, protected bool, username string, config GameConfi
148148
return nil, "", fmt.Errorf("failed to join game: %s", err)
149149
}
150150

151+
config, err = cg.FetchGameConfig[GameConfig](socket, gameId)
152+
if err != nil {
153+
return nil, "", err
154+
}
155+
151156
return &Game{
152157
Id: gameId,
153158
Config: config,
@@ -172,6 +177,11 @@ func CreateAndSpectateGame(public, protected bool, config GameConfig) (*Game, st
172177
return nil, "", fmt.Errorf("failed to spectate game: %s", err)
173178
}
174179

180+
config, err = cg.FetchGameConfig[GameConfig](socket, gameId)
181+
if err != nil {
182+
return nil, "", err
183+
}
184+
175185
return &Game{
176186
Id: gameId,
177187
Config: config,

0 commit comments

Comments
 (0)