You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
21 lines
434 B
21 lines
434 B
3 years ago
|
import axios from 'axios'
|
||
|
|
||
|
axios.interceptors.request.use(
|
||
|
async config => {
|
||
|
return config;
|
||
|
},
|
||
|
error => {
|
||
|
Promise.reject(error)
|
||
|
});
|
||
|
|
||
|
axios.interceptors.response.use((response) => {
|
||
|
return response
|
||
|
}, async function (error) {
|
||
|
if (error.response.status == 401) {
|
||
|
localStorage.clear();
|
||
|
window.location = window.location.origin;
|
||
|
}
|
||
|
return Promise.reject(error);
|
||
|
});
|
||
|
|
||
|
export default axios
|