Rename; Added EMS server; redis compose

This commit is contained in:
cracklesparkle
2024-08-20 17:34:21 +09:00
parent 61339f4c26
commit 97b44a4db7
85 changed files with 2832 additions and 188 deletions

View File

@ -0,0 +1,27 @@
import axios, { ResponseType } from 'axios';
import { useAuthStore } from '../store/auth';
const axiosInstance = axios.create();
axiosInstance.interceptors.request.use(
(config) => {
const token = useAuthStore.getState().token;
if (token) {
config.headers['Authorization'] = `Bearer ${token}`;
}
return config;
},
(error) => {
return Promise.reject(error);
}
);
export const fetcher = (url: string, baseURL?: string, responseType?: ResponseType) => axiosInstance.get(url, {
baseURL: baseURL || import.meta.env.VITE_API_INFO_URL,
headers: {
'Content-Type': 'application/x-www-form-urlencoded'
},
responseType: responseType ? responseType : "json"
}).then(res => res.data)
export default axiosInstance;