thrimbletrimmer: Always alert() on errors

pull/211/head
Mike Lang 4 years ago committed by Mike Lang
parent 27265f3bca
commit 337111a9ab

@ -61,6 +61,10 @@ pageSetup = function(isEditor) {
if (isEditor) { document.getElementById('SubmitButton').disabled = true; } if (isEditor) { document.getElementById('SubmitButton').disabled = true; }
fetch("/thrimshim/defaults").then(data => data.json()).then(function (data) { fetch("/thrimshim/defaults").then(data => data.json()).then(function (data) {
if (!data) {
alert("Editor results call failed, is thrimshim running?");
return;
}
desertBusStart = new Date(data.bustime_start); desertBusStart = new Date(data.bustime_start);
document.getElementById("StreamName").value = data.video_channel; document.getElementById("StreamName").value = data.video_channel;
if (isEditor) { if (isEditor) {
@ -286,16 +290,14 @@ thrimbletrimmerSubmit = function(state, override_changes=false) {
.then(response => response.text().then(text => { .then(response => response.text().then(text => {
if (!response.ok) { if (!response.ok) {
var error = response.statusText + ": " + text; var error = response.statusText + ": " + text;
console.log(error); if (response.status == 409) {
if (response.status == 409) { dialogue = text + "\nClick Ok to submit anyway; Click Cancel to return to editing"
dialogue = text + "\nClick Ok to submit anyway; Click Cancel to return to editing" if (confirm(dialogue)) {
if (confirm(dialogue)) { thrimbletrimmerSubmit(state, true);
thrimbletrimmerSubmit(state, true); }
} else {
} else { alert(error);
alert(error); }
}
}
} else if (state == 'EDITED') { } else if (state == 'EDITED') {
// Only return to dashboard if submitted, not for save draft // Only return to dashboard if submitted, not for save draft
setTimeout(() => { window.location.href = '/thrimbletrimmer/dashboard.html'; }, 500); setTimeout(() => { window.location.href = '/thrimbletrimmer/dashboard.html'; }, 500);

Loading…
Cancel
Save