entity-search-input tableName 유효성 검증 추가 및 에러 메시지 개선
This commit is contained in:
@@ -34,6 +34,13 @@ export function useEntitySearch({
|
||||
|
||||
const search = useCallback(
|
||||
async (text: string, page: number = 1) => {
|
||||
// tableName 유효성 검증
|
||||
if (!tableName || tableName === "undefined" || tableName === "null") {
|
||||
console.warn("엔티티 검색 건너뜀: tableName이 없음", { tableName });
|
||||
setError("테이블명이 설정되지 않았습니다. 컴포넌트 설정을 확인해주세요.");
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
setLoading(true);
|
||||
setError(null);
|
||||
@@ -60,7 +67,8 @@ export function useEntitySearch({
|
||||
}
|
||||
} catch (err: any) {
|
||||
console.error("Entity search error:", err);
|
||||
setError(err.response?.data?.message || "검색 중 오류가 발생했습니다");
|
||||
const errorMessage = err.response?.data?.message || "검색 중 오류가 발생했습니다";
|
||||
setError(errorMessage);
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user