Browse Source

Fix ajax interceptor

pull/1/head
Wahyu Ramadhan 1 year ago
parent
commit
adde2a013a
  1. 18
      view-mode/function/ganttConfig.js

18
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{
if (config.url !== `${base_url}project/s-curve-command`) {
$("body").addClass("loading"); $("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 {
if (config.url !== `${base_url}project/s-curve-command`) {
$("body").removeClass("loading"); $("body").removeClass("loading");
}
} }
catch(e) catch(e)
{ {
@ -60,11 +64,17 @@ $.ajaxSetup({
} }
}); });
$(document).on({
ajaxStart: function(){ $(document).ajaxStart(function(event) {
var url = event.target.URL;
if (url !== `${base_url}project/s-curve-command`) {
$("body").addClass("loading"); $("body").addClass("loading");
}, }
ajaxStop: function(){ });
$(document).ajaxComplete(function(event) {
var url = event.target.URL;
if (url !== `${base_url}project/s-curve-command`) {
$("body").removeClass("loading"); $("body").removeClass("loading");
} }
}); });

Loading…
Cancel
Save