Files
aso/frontend/client-portal/src/utils/axios.ts
2022-11-03 09:51:22 +07:00

28 lines
606 B
TypeScript
Executable File

import axios from 'axios';
// config
import { HOST_API } from '../config';
import { getSession } from './token';
// ----------------------------------------------------------------------
const token = getSession();
const axiosInstance = axios.create({
baseURL: HOST_API,
// headers: {
// 'X-Requested-With': 'XMLHttpRequest',
// },
// withCredentials: true,
// headers: {
// Authorization: `Bearer ${token}`
// }
});
axiosInstance.interceptors.response.use(
(response) => response,
(error) => Promise.reject((error) || 'Something went wrong')
);
export default axiosInstance;