Merge branch 'dev' of http://39.117.244.52:3000/kjs/ERP-node into dataflowMng
This commit is contained in:
@@ -95,6 +95,12 @@ apiClient.interceptors.request.use(
|
||||
console.warn("⚠️ 토큰이 없습니다.");
|
||||
}
|
||||
|
||||
// FormData 요청 시 Content-Type 자동 처리
|
||||
if (config.data instanceof FormData) {
|
||||
console.log("📎 FormData 감지 - Content-Type 헤더 제거");
|
||||
delete config.headers["Content-Type"];
|
||||
}
|
||||
|
||||
// 언어 정보를 쿼리 파라미터에 추가 (GET 요청 시에만)
|
||||
if (config.method?.toUpperCase() === "GET") {
|
||||
// 우선순위: 전역 변수 > localStorage > 기본값
|
||||
|
||||
@@ -36,7 +36,7 @@ export const uploadFiles = async (files: FileList): Promise<FileUploadResponse>
|
||||
|
||||
const response = await apiClient.post("/files/upload", formData, {
|
||||
headers: {
|
||||
"Content-Type": "multipart/form-data",
|
||||
"Content-Type": undefined, // axios가 자동으로 multipart/form-data를 설정하도록
|
||||
},
|
||||
});
|
||||
|
||||
@@ -144,3 +144,29 @@ export const uploadFilesAndCreateData = async (files: FileList) => {
|
||||
throw error;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* 테이블 연결된 파일 조회
|
||||
*/
|
||||
export const getLinkedFiles = async (
|
||||
tableName: string,
|
||||
recordId: string,
|
||||
): Promise<{
|
||||
success: boolean;
|
||||
files: any[];
|
||||
totalCount: number;
|
||||
targetObjid: string;
|
||||
}> => {
|
||||
try {
|
||||
console.log("📎 연결된 파일 조회:", { tableName, recordId });
|
||||
|
||||
const response = await apiClient.get(`/files/linked/${tableName}/${recordId}`);
|
||||
|
||||
console.log("✅ 연결된 파일 조회 성공:", response.data);
|
||||
|
||||
return response.data;
|
||||
} catch (error) {
|
||||
console.error("연결된 파일 조회 오류:", error);
|
||||
throw new Error("연결된 파일 조회에 실패했습니다.");
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user