How to add global loading/spin effect in axios interceptor for a React project
问题 I am use axios for API call in a React project, and I want to add a loading or spinning effect globally in between a api call's request and response in my axios interceptor, here is the code of my interceptor. import Axios from 'axios' Axios.interceptors.request.use(function (config) { // spinning start to show const token = window.localStorage.token; if (token) { config.headers.Authorization = `token ${token}` } return config }, function (error) { return Promise.reject(error); }); Axios