Files
mixtape/zero.Web/App/axios.config.js
T
2020-04-11 22:08:06 +02:00

26 lines
598 B
JavaScript

import Axios from 'axios';
import Auth from 'zero/services/auth';
if (!zero || !zero.apiPath)
{
throw Exception('window.zero and zero.apiPath (= base path to the backoffice API) have to be configured');
}
Axios.defaults.baseURL = zero.apiPath;
Axios.defaults.withCredentials = true;
Axios.interceptors.response.use(response => response, error =>
{
if (error.response)
{
if (error.response.status === 401)
{
Auth.rejectUser();
//Notification.error('Authentication failed. Please login again.', 3);
}
}
return Promise.reject(error);
});
export default Axios;