This commit is contained in:
Malai Raja
2023-11-27 17:09:27 +05:30
commit 7113ac0681
223 changed files with 56261 additions and 0 deletions

17
src/utils/axios.js Normal file
View File

@@ -0,0 +1,17 @@
import axios from 'axios';
const axiosServices = axios.create({ baseURL: process.env.REACT_APP_API_URL || 'http://localhost:3010/' });
// ==============================|| AXIOS - FOR MOCK SERVICES ||============================== //
axiosServices.interceptors.response.use(
(response) => response,
(error) => {
if (error.response.status === 401 && !window.location.href.includes('/login')) {
window.location = '/login';
}
return Promise.reject((error.response && error.response.data) || 'Wrong Services');
}
);
export default axiosServices;