We have react app and it implements axios interceptors, means if any network call responds 401 it redirect to login page. Next, we are using another react local library(lets say authLib) which is also implements same axios interceptors. So when network responds 401 error, both are executing(one for main app and another one for local library). How can we avoid to call once or override the axios interceptor.
var axiosObj = axios.create();
axiosObj.interceptors.request.use(function (config) {
return response;
}, function (error) {
if (error && error.response && error.response.status === 401) {
logout();
return; }
return Promise.reject(error);});