fix possibility of 404 on home if getRandomGame has no validy elements to return

this can happen when user has no internet connection when opening hydra
This commit is contained in:
Zamitto
2024-04-27 20:43:34 -03:00
parent 0b8ebcbfd8
commit 15edc1698a
2 changed files with 21 additions and 20 deletions

View File

@@ -58,14 +58,12 @@ export function Home() {
const getRandomGame = useCallback(() => {
setIsLoadingRandomGame(true);
window.electron
.getRandomGame()
.then((objectID) => {
window.electron.getRandomGame().then((objectID) => {
if (objectID) {
randomGameObjectID.current = objectID;
})
.finally(() => {
setIsLoadingRandomGame(false);
});
}
});
}, []);
const handleRandomizerClick = () => {