This commit is contained in:
ostertun
2020-10-05 17:35:10 +02:00
parent 203c2534eb
commit fcf9dc9a20
3 changed files with 362 additions and 359 deletions

View File

@@ -483,6 +483,7 @@ function sync() {
if (!canUseLocalDB) return false; if (!canUseLocalDB) return false;
if (syncInProgress > 0) return false; if (syncInProgress > 0) return false;
return new Promise(function(resolve) {
var now = Math.floor(Date.now() / 1000); var now = Math.floor(Date.now() / 1000);
db.transaction('update_times').objectStore('update_times').getAll().onsuccess = function (event) { db.transaction('update_times').objectStore('update_times').getAll().onsuccess = function (event) {
@@ -513,6 +514,7 @@ function sync() {
} }
removeSyncInfoToPreloader(); removeSyncInfoToPreloader();
runPageScript(); runPageScript();
resolve();
} }
}, 100); }, 100);
@@ -910,6 +912,7 @@ function sync() {
} }
}); });
}; };
});
} }
function checkSync() { function checkSync() {

View File

@@ -18,13 +18,13 @@ async function planningSwitchChanged() {
}, },
error: function (xhr, status, error) { error: function (xhr, status, error) {
if (xhr.status == 401) { if (xhr.status == 401) {
console.log('authentification failed'); log('authentification failed');
toastError('Authentifizierung fehlgeschlagen. Versuche es erneut.'); toastError('Authentifizierung fehlgeschlagen. Versuche es erneut.');
} else if (xhr.status == 0) { } else if (xhr.status == 0) {
toastError('Du bist momentan offline.<br>Stelle eine Internetverbindung her, um den Status zu &auml;ndern'); toastError('Du bist momentan offline.<br>Stelle eine Internetverbindung her, um den Status zu &auml;ndern');
} else { } else {
console.log('Login: unbekannter Fehler', status, error); log('Login: unbekannter Fehler', status, error);
console.log(xhr); log(xhr);
toastError('Ein unbekannter Fehler ist aufgetreten. Bitte versuche es noch einmal', 5000); toastError('Ein unbekannter Fehler ist aufgetreten. Bitte versuche es noch einmal', 5000);
} }
$('#menu-status').hideMenu(); $('#menu-status').hideMenu();

View File

@@ -17,13 +17,13 @@ async function planningSwitchChanged() {
}, },
error: function (xhr, status, error) { error: function (xhr, status, error) {
if (xhr.status == 401) { if (xhr.status == 401) {
console.log('authentification failed'); log('authentification failed');
toastError('Authentifizierung fehlgeschlagen. Versuche es erneut.'); toastError('Authentifizierung fehlgeschlagen. Versuche es erneut.');
} else if (xhr.status == 0) { } else if (xhr.status == 0) {
toastError('Du bist momentan offline.<br>Stelle eine Internetverbindung her, um die &Auml;nderungen zu speichern'); toastError('Du bist momentan offline.<br>Stelle eine Internetverbindung her, um die &Auml;nderungen zu speichern');
} else { } else {
console.log('planning_add: unbekannter Fehler', status, error); log('planning_add: unbekannter Fehler', status, error);
console.log(xhr); log(xhr);
toastError('Ein unbekannter Fehler ist aufgetreten. Bitte versuche es noch einmal', 5000); toastError('Ein unbekannter Fehler ist aufgetreten. Bitte versuche es noch einmal', 5000);
} }
$('#menu-edit').hideMenu(); $('#menu-edit').hideMenu();
@@ -46,13 +46,13 @@ async function planningSwitchChanged() {
}, },
error: function (xhr, status, error) { error: function (xhr, status, error) {
if (xhr.status == 401) { if (xhr.status == 401) {
console.log('authentification failed'); log('authentification failed');
toastError('Authentifizierung fehlgeschlagen. Versuche es erneut.'); toastError('Authentifizierung fehlgeschlagen. Versuche es erneut.');
} else if (xhr.status == 0) { } else if (xhr.status == 0) {
toastError('Du bist momentan offline.<br>Stelle eine Internetverbindung her, um die &Auml;nderungen zu speichern'); toastError('Du bist momentan offline.<br>Stelle eine Internetverbindung her, um die &Auml;nderungen zu speichern');
} else { } else {
console.log('planning_remove: unbekannter Fehler', status, error); log('planning_remove: unbekannter Fehler', status, error);
console.log(xhr); log(xhr);
toastError('Ein unbekannter Fehler ist aufgetreten. Bitte versuche es noch einmal', 5000); toastError('Ein unbekannter Fehler ist aufgetreten. Bitte versuche es noch einmal', 5000);
} }
$('#menu-edit').hideMenu(); $('#menu-edit').hideMenu();
@@ -90,13 +90,13 @@ async function sailorSelected(sid) {
}, },
error: function (xhr, status, error) { error: function (xhr, status, error) {
if (xhr.status == 401) { if (xhr.status == 401) {
console.log('authentification failed'); log('authentification failed');
toastError('Authentifizierung fehlgeschlagen. Versuche es erneut.'); toastError('Authentifizierung fehlgeschlagen. Versuche es erneut.');
} else if (xhr.status == 0) { } else if (xhr.status == 0) {
toastError('Du bist momentan offline.<br>Stelle eine Internetverbindung her, um die &Auml;nderungen zu speichern'); toastError('Du bist momentan offline.<br>Stelle eine Internetverbindung her, um die &Auml;nderungen zu speichern');
} else { } else {
console.log(action + ': unbekannter Fehler', status, error); log(action + ': unbekannter Fehler', status, error);
console.log(xhr); log(xhr);
toastError('Ein unbekannter Fehler ist aufgetreten. Bitte versuche es noch einmal', 5000); toastError('Ein unbekannter Fehler ist aufgetreten. Bitte versuche es noch einmal', 5000);
} }
hideLoader(); hideLoader();
@@ -167,13 +167,13 @@ async function planningChangeCrew(sid = null) {
}, },
error: function (xhr, status, error) { error: function (xhr, status, error) {
if (xhr.status == 401) { if (xhr.status == 401) {
console.log('authentification failed'); log('authentification failed');
toastError('Authentifizierung fehlgeschlagen. Versuche es erneut.'); toastError('Authentifizierung fehlgeschlagen. Versuche es erneut.');
} else if (xhr.status == 0) { } else if (xhr.status == 0) {
toastError('Du bist momentan offline.<br>Stelle eine Internetverbindung her, um die &Auml;nderungen zu speichern'); toastError('Du bist momentan offline.<br>Stelle eine Internetverbindung her, um die &Auml;nderungen zu speichern');
} else { } else {
console.log('planning_remove_crew: unbekannter Fehler', status, error); log('planning_remove_crew: unbekannter Fehler', status, error);
console.log(xhr); log(xhr);
toastError('Ein unbekannter Fehler ist aufgetreten. Bitte versuche es noch einmal', 5000); toastError('Ein unbekannter Fehler ist aufgetreten. Bitte versuche es noch einmal', 5000);
} }
$('#menu-edit').hideMenu(); $('#menu-edit').hideMenu();