Skip to content

Commit

Permalink
Fetch config from server in Create… methods
Browse files Browse the repository at this point in the history
  • Loading branch information
juho05 committed Aug 10, 2022
1 parent a10b1fb commit 4e1af1a
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions templates/new/client/game.go.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,11 @@ func CreateAndJoinGame(public, protected bool, username string, config GameConfi
return nil, "", fmt.Errorf("failed to join game: %s", err)
}

config, err = cg.FetchGameConfig[GameConfig](socket, gameId)
if err != nil {
return nil, "", err
}

return &Game{
Id: gameId,
Config: config,
Expand All @@ -172,6 +177,11 @@ func CreateAndSpectateGame(public, protected bool, config GameConfig) (*Game, st
return nil, "", fmt.Errorf("failed to spectate game: %s", err)
}

config, err = cg.FetchGameConfig[GameConfig](socket, gameId)
if err != nil {
return nil, "", err
}

return &Game{
Id: gameId,
Config: config,
Expand Down

0 comments on commit 4e1af1a

Please sign in to comment.