make manifest fix more future proof

This commit is contained in:
Moka 2024-10-27 18:34:12 +01:00
parent 49c4700fae
commit 32591b35d0
1 changed files with 7 additions and 4 deletions

View File

@ -99,13 +99,16 @@ const startGame = async (manifest?: any) => {
}
};
let manifest: any;
fetch("/manifest.json")
.then(res => res.json())
.then(jsonResponse => {
startGame(jsonResponse.manifest);
}).catch(() => {
// Manifest not found (likely local build)
startGame();
manifest = jsonResponse.manifest;
}).catch(err => {
// Manifest not found (likely local build or error path on live)
console.log(`Manifest not found. ${err}`);
}).finally(() => {
startGame(manifest);
});
export default game;