fix(front): Handle "Failed to fetch dynamically imported module" errors by refreshing the page

Reference: https://stackoverflow.com/a/74861436/10204399

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel 2023-05-03 10:02:15 +02:00
parent b586f59288
commit 3d21a06789
No known key found for this signature in database
GPG Key ID: A061B9DDE0CA0773

View File

@ -205,3 +205,12 @@ router.beforeEach(authGuardIfNeeded);
// console.error(e); // console.error(e);
// } // }
// }); // });
router.onError((error, to) => {
if (
error.message.includes("Failed to fetch dynamically imported module") ||
error.message.includes("Importing a module script failed")
) {
window.location.href = to.fullPath;
}
});