Browse Source

JavaScript: Improve control flow of development mode function

master
Riyyi 3 years ago
parent
commit
9af5f50135
  1. 26
      public/js/app.js

26
public/js/app.js

@ -241,23 +241,23 @@ $(document).ready(function() {
$.get('/admin/toggle-development-mode').done(function(data) $.get('/admin/toggle-development-mode').done(function(data)
{ {
const response = JSON.parse(data); const response = JSON.parse(data);
if (response.success == true) { if (response.success == false) {
if (response.result.value == 'on') { console.log(data);
e.target.checked = true; alert("Development mode could not be enabled!");
$('#develop-enabled').css('visibility', 'visible'); return;
$('#develop-remaining').text('03:00:00'); }
}
else {
e.target.checked = false;
$('#develop-enabled').css('visibility', 'hidden');
}
alert("Development mode has been set to: '" + response.result.value + "'"); if (response.result.value == 'on') {
e.target.checked = true;
$('#develop-enabled').css('visibility', 'visible');
$('#develop-remaining').text('03:00:00');
} }
else { else {
console.log(data); e.target.checked = false;
alert("Development mode could not be enabled!") $('#develop-enabled').css('visibility', 'hidden');
} }
alert("Development mode has been set to: '" + response.result.value + "'");
}); });
}); });

Loading…
Cancel
Save