debug: 카테고리 API 응답 원본 데이터 구조 확인
문제: - value: undefined, label: undefined로 나옴 - v.categoryValue, v.categoryLabel이 존재하지 않음 디버깅: - API 응답의 첫 번째 항목 전체 출력 - 객체의 모든 키 목록 출력 - 여러 가능한 속성명 시도: - category_value / categoryValue / value - category_label / categoryLabel / label 다음 단계: - 콘솔에서 원본 데이터 구조 확인 - 실제 속성명에 맞게 매핑 수정
This commit is contained in:
parent
4928c54985
commit
114a807d79
|
|
@ -158,10 +158,15 @@ const SelectBasicComponent: React.FC<SelectBasicComponentProps> = ({
|
||||||
console.log("🔍 [SelectBasic] 카테고리 API 응답:", response);
|
console.log("🔍 [SelectBasic] 카테고리 API 응답:", response);
|
||||||
|
|
||||||
if (response.success && response.data) {
|
if (response.success && response.data) {
|
||||||
|
console.log("🔍 [SelectBasic] 원본 데이터 샘플:", {
|
||||||
|
firstItem: response.data[0],
|
||||||
|
keys: response.data[0] ? Object.keys(response.data[0]) : [],
|
||||||
|
});
|
||||||
|
|
||||||
const activeValues = response.data.filter((v) => v.isActive !== false);
|
const activeValues = response.data.filter((v) => v.isActive !== false);
|
||||||
const options = activeValues.map((v) => ({
|
const options = activeValues.map((v) => ({
|
||||||
value: v.categoryValue,
|
value: v.category_value || v.categoryValue || v.value,
|
||||||
label: v.categoryLabel || v.categoryValue,
|
label: v.category_label || v.categoryLabel || v.label || v.category_value || v.categoryValue || v.value,
|
||||||
}));
|
}));
|
||||||
|
|
||||||
console.log("✅ [SelectBasic] 카테고리 옵션 설정:", {
|
console.log("✅ [SelectBasic] 카테고리 옵션 설정:", {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue