Browse Source

Fix ajax interceptor

pull/1/head
Wahyu Ramadhan 2 years ago
parent
commit
adde2a013a
  1. 28
      view-mode/function/ganttConfig.js

28
view-mode/function/ganttConfig.js

@ -21,7 +21,9 @@ const axiosInstance = axios.create({
axiosInstance.interceptors.request.use(async (config) => { axiosInstance.interceptors.request.use(async (config) => {
try{ try{
$("body").addClass("loading"); if (config.url !== `${base_url}project/s-curve-command`) {
$("body").addClass("loading");
}
} }
catch(e) catch(e)
{ {
@ -34,7 +36,9 @@ axiosInstance.interceptors.request.use(async (config) => {
axiosInstance.interceptors.response.use(async (config) => { axiosInstance.interceptors.response.use(async (config) => {
try { try {
$("body").removeClass("loading"); if (config.url !== `${base_url}project/s-curve-command`) {
$("body").removeClass("loading");
}
} }
catch(e) catch(e)
{ {
@ -60,13 +64,19 @@ $.ajaxSetup({
} }
}); });
$(document).on({
ajaxStart: function(){ $(document).ajaxStart(function(event) {
$("body").addClass("loading"); var url = event.target.URL;
}, if (url !== `${base_url}project/s-curve-command`) {
ajaxStop: function(){ $("body").addClass("loading");
$("body").removeClass("loading"); }
} });
$(document).ajaxComplete(function(event) {
var url = event.target.URL;
if (url !== `${base_url}project/s-curve-command`) {
$("body").removeClass("loading");
}
}); });
gantt.plugins({ gantt.plugins({

Loading…
Cancel
Save