Add error message to player-settings and weighted-settings pages if the call to /api/generate returns a non-2xx response code.

This commit is contained in:
Chris Wilson
2021-05-13 21:33:56 -04:00
parent b2f3fd56f4
commit c24d6a0785
6 changed files with 33 additions and 1 deletions

View File

@@ -170,6 +170,12 @@ const generateGame = (raceMode = false) => {
race: raceMode ? '1' : '0',
}).then((response) => {
window.location.href = response.data.url;
}).catch((error) => {
const userMessage = document.getElementById('user-message');
userMessage.innerText = 'Something went wrong and your game could not be generated.';
userMessage.classList.add('visible');
window.scrollTo(0, 0);
console.error(error);
});
};