Skip to content

Commit

Permalink
Added 'redirectOnFail' and set stats requests to not do so
Browse files Browse the repository at this point in the history
  • Loading branch information
JahleelAbraham authored Mar 15, 2024
1 parent ba7c7c1 commit ee91de2
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions www/template/dist/js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ function updateStatData() {
snr.hide();
}
}
});
}, false);
setTimeout("updateStatData();", 2000);
}

Expand Down Expand Up @@ -178,7 +178,7 @@ var ajaxReq = function () {
var class_after_success = null;


var send = function () {
var send = function (redirectOnFail) {
if (form !== null) form_data = new FormData(form[0]);

if (alert_bl !== null) {
Expand Down Expand Up @@ -241,9 +241,11 @@ var ajaxReq = function () {
respProc(msg);
})
.fail(function(msg) {
// This is workaround for ublockORIGIN browser plugin which blocks get HTML requests(logs page - issue #474).
console.error('Request failed redirecting to ' + form_act)
location.href = location.origin + form_act
if(redirectOnFail) {
// This is workaround for ublockORIGIN browser plugin which blocks get HTML requests(logs page - issue #474).
console.error('Request failed redirecting to ' + form_act)
location.href = location.origin + form_act
}

if (error_ajax) alert('err ajax');

Expand Down Expand Up @@ -442,7 +444,7 @@ var ajaxReq = function () {
else error_ajax = 1;

//form.submit();
send();
send(true);
}

return false;
Expand Down Expand Up @@ -476,7 +478,7 @@ var ajaxReq = function () {
ajax_content = true;
mch_ajsend(send_but);

send();
send(true);

// close left menu for mobile devices
var navbar = $('#navbar-collapse');
Expand All @@ -485,7 +487,7 @@ var ajaxReq = function () {
return false;
};

self.manReq = function (data) {
self.manReq = function (data, redirectOnFail = true) {
form_act = data.form_act || null;
type_req = data.type_req || type_req;
type_data = data.type_data || type_data;
Expand All @@ -509,7 +511,7 @@ var ajaxReq = function () {
//if ((data.callback_func !== null) && (typeof(data.callback_func === 'function'))) {
//callback_func = data.callback_func;
//};
send();
send(redirectOnFail);
};

var constructor = function () {
Expand All @@ -519,7 +521,7 @@ var ajaxReq = function () {
function ajaxEvent() {
$('body').on("click", ".send-req-form", function(e){
var ajax_req = new ajaxReq();
return ajax_req.setData($(this));
return ajax_req.setData($(this));
});

$('body').on("change", ".send-req-form-select", function(e){
Expand Down

0 comments on commit ee91de2

Please sign in to comment.