diff --git a/src/components/EditGameForm.js b/src/components/EditGameForm.js index 88c4fa0f72e98425ef81c926d7a1ff6553f55ad7..55247e638269ca8cb9d888d972cc9ec75aa08857 100644 --- a/src/components/EditGameForm.js +++ b/src/components/EditGameForm.js @@ -258,12 +258,16 @@ export class EditGameForm extends React.Component { }, body: JSON.stringify(gameObject) }) - .then(res => res.json()) + .then(res => { + if (!res.ok) { + throw Error(res.statusMessage); + } else { + return res.json(); + } + }) .then(result => { alert(result.message); - if (result.code === 200) { - this.handleView(); - } + this.handleView(); }) .catch(error => console.log("Error: ", error)); };