Separate Client Portal & Dashboard
This commit is contained in:
27
frontend/dashboard/src/utils/axios.ts
Normal file
27
frontend/dashboard/src/utils/axios.ts
Normal file
@@ -0,0 +1,27 @@
|
||||
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.response && error.response.data) || 'Something went wrong')
|
||||
);
|
||||
|
||||
export default axiosInstance;
|
||||
Reference in New Issue
Block a user