fix: production save errors and import HR dashboard data
Resolve invalid task creator IDs, fix API routing and file uploads on Vercel, and replace dummy seed data with HR_Dashboard import.
This commit is contained in:
@@ -1,10 +1,13 @@
|
||||
import axios from 'axios';
|
||||
|
||||
// 개발: Vite 프록시 → /api (localhost:4000)
|
||||
// 배포: VITE_API_URL=https://xxx.onrender.com 설정 시 그 주소 사용
|
||||
// 배포: VITE_API_URL 미설정 시 Render 백엔드 기본값 사용
|
||||
const RENDER_API = 'https://eene-dashboard-backend.onrender.com';
|
||||
const baseURL = import.meta.env.VITE_API_URL
|
||||
? `${import.meta.env.VITE_API_URL}/api`
|
||||
: '/api';
|
||||
: import.meta.env.PROD
|
||||
? `${RENDER_API}/api`
|
||||
: '/api';
|
||||
|
||||
export const apiClient = axios.create({
|
||||
baseURL,
|
||||
@@ -13,7 +16,19 @@ export const apiClient = axios.create({
|
||||
},
|
||||
});
|
||||
|
||||
apiClient.interceptors.request.use((config) => {
|
||||
if (config.data instanceof FormData) {
|
||||
delete config.headers['Content-Type'];
|
||||
}
|
||||
return config;
|
||||
});
|
||||
|
||||
apiClient.interceptors.response.use(
|
||||
(res) => res,
|
||||
(error) => Promise.reject(error),
|
||||
);
|
||||
|
||||
export function getApiErrorMessage(err: unknown, fallback: string): string {
|
||||
const ax = err as { response?: { data?: { message?: string }; status?: number }; message?: string };
|
||||
return ax.response?.data?.message || ax.message || fallback;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user