Files
aso/frontend/dashboard/src/utils/axios.ts
2023-07-03 11:39:08 +07:00

28 lines
611 B
TypeScript

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