diff --git a/frontend/src/components/common/NewVersionDialog.vue b/frontend/src/components/common/NewVersionDialog.vue index ef724df8f..16e4de650 100644 --- a/frontend/src/components/common/NewVersionDialog.vue +++ b/frontend/src/components/common/NewVersionDialog.vue @@ -15,19 +15,23 @@ function dismissVersionBanner() { latestVersionDismissed.value = true; } onMounted(async () => { - const response = await fetch( - "https://api.github.com/repos/rommapp/romm/releases/latest", - ); - const json = await response.json(); - GITHUB_VERSION.value = json.tag_name; - const publishedAt = new Date(json.published_at); - latestVersionDismissed.value = - // Hide if the version is not valid - !semver.valid(VERSION) || - // Hide if the version is the same as the dismissed version - json.tag_name === localStorage.getItem("dismissedVersion") || - // Hide if the version is less than 2 hours old - publishedAt.getTime() + 2 * 60 * 60 * 1000 > Date.now(); + try { + const response = await fetch( + "https://api.github.com/repos/rommapp/romm/releases/latest", + ); + const json = await response.json(); + GITHUB_VERSION.value = json.tag_name; + const publishedAt = new Date(json.published_at); + latestVersionDismissed.value = + // Hide if the version is not valid + !semver.valid(VERSION) || + // Hide if the version is the same as the dismissed version + json.tag_name === localStorage.getItem("dismissedVersion") || + // Hide if the version is less than 2 hours old + publishedAt.getTime() + 2 * 60 * 60 * 1000 > Date.now(); + } catch (error) { + console.error("Failed to fetch latest version from Github", error); + } });