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)
{
const response = JSON.parse(data);
if (response.success == true) {
if (response.result.value == 'on') {
e.target.checked = true;
$('#develop-enabled').css('visibility', 'visible');
$('#develop-remaining').text('03:00:00');
}
else {
e.target.checked = false;
$('#develop-enabled').css('visibility', 'hidden');
}
if (response.success == false) {
console.log(data);
alert("Development mode could not be enabled!");
return;
}
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 {
console.log(data);
alert("Development mode could not be enabled!")
e.target.checked = false;
$('#develop-enabled').css('visibility', 'hidden');
}
alert("Development mode has been set to: '" + response.result.value + "'");
});
});

Loading…
Cancel
Save