An open-source cross-platform alternative to AirDrop
fix: show an error when web share translations fail to load (#3527)
Shlomod84fcb2bfe3f
diff --git a/packages/core/assets/web/download.html b/packages/core/assets/web/download.htmlindex a6f83730..4d662dcc 100644--- a/packages/core/assets/web/download.html+++ b/packages/core/assets/web/download.html@@ -196,10 +196,17 @@function fetchI18n(then) {makeRequest('/i18n.json', 'GET', function (response) {- if (response.status === 200) {+ if (response.status !== 200) {+ alert('Could not load translations. Please reload the page to try again.');+ return;+ }+ try {i18n = JSON.parse(response.responseText);- then();+ } catch (e) {+ alert('Could not parse translations. Please reload the page to try again.');+ return;}+ then();});}diff --git a/packages/core/assets/web/upload.html b/packages/core/assets/web/upload.htmlindex 2a9a75c7..f5e19caa 100644--- a/packages/core/assets/web/upload.html+++ b/packages/core/assets/web/upload.html@@ -109,13 +109,20 @@function fetchI18n(then) {makeRequest('/i18n.json', 'GET', null, function (response) {- if (response.status === 200) {+ if (response.status !== 200) {+ alert('Could not load translations. Please reload the page to try again.');+ return;+ }+ try {i18n = JSON.parse(response.responseText);- if (i18n.dropHint) {- document.getElementById('drop-hint').innerText = i18n.dropHint;- }- then();+ } catch (e) {+ alert('Could not parse translations. Please reload the page to try again.');+ return;+ }+ if (i18n.dropHint) {+ document.getElementById('drop-hint').innerText = i18n.dropHint;}+ then();});}