Skip to content
Snippets Groups Projects
Commit 09fd046d authored by Joni Laukka's avatar Joni Laukka
Browse files

Bug solved: gamelist keeps its value after toggleview

parent 5cc29937
No related branches found
No related tags found
2 merge requests!26Development,!22Join, edit game form
......@@ -23,9 +23,10 @@ class GameList extends React.Component {
fetch(`${process.env.REACT_APP_URL}/game/listgames`)
.then(response => response.json())
.then(games => {
let selectedGame = this.state.selectedGame !== undefined ? this.state.selectedGame : undefined;
this.setState({
games: games,
selectedGame: games !== undefined && games[0].id
selectedGame: selectedGame !== undefined ? selectedGame : games !== undefined ? games[0].id : undefined
});
})
.catch(error => {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment