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

Changed two fetches into one fetch

parent 17a4241d
No related branches found
No related tags found
2 merge requests!46Development to testing,!35Password fix
......@@ -29,22 +29,19 @@ export default class GameView extends React.Component {
.then(res => {
if (!res.ok) {
throw Error();
} else {
return res.json();
}
})
.catch(error => {
alert("Game not found");
window.document.location.href = "/";
});
// Get game info
fetch(`${process.env.REACT_APP_API_URL}/game/${gameId}`)
.then(res => res.json())
.then(res => {
this.setState({
gameInfo: res
});
})
.catch(error => console.log(error));
.catch(error => {
alert("Game not found");
window.document.location.href = "/";
});
// Get Role
fetch(`${process.env.REACT_APP_API_URL}/faction/check-faction/${gameId}`, {
......
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