import axios, {AxiosError} from 'axios'; import clientsideConfig from './clientsideConfig' //create axios instance const Axios = axios.create({ //baseURL: `https://${serversideConfig.url}:${serversideConfig.port}/`, baseURL: `https://${clientsideConfig.url}:${clientsideConfig.port}/`, headers: { // 'Accept': 'application/json', 'Content-Type': 'application/json', //Authorization: `Bearer`, Accept: "*", }, withCredentials: true, credentials: true, }) Axios.interceptors.response.use((response) => response, (error) => { if (error instanceof AxiosError) { console.error('Status: ', error.response?.status, '\nHeaders: '. error.response?.headers, '\nMessage: '. error.response?.data.message) } else { console.error('Error: ', error); }; if (error.response?.status === 403) { window.location.href = '/login'; }; return Promise.reject(error); }); export default Axios;