From dd1ac022d2f63c8fcfb6e0ec94f8dee0ab42d7fb Mon Sep 17 00:00:00 2001 From: HYOJIN Date: Tue, 14 Apr 2026 13:57:53 +0900 Subject: [PATCH] =?UTF-8?q?feat(api-hub):=20API=20HUB=20=EC=83=81=EC=84=B8?= =?UTF-8?q?=20=ED=99=94=EB=A9=B4=20=EA=B0=9C=EC=84=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 요청 URL 생성 영역 아코디언 형태로 변경 - 샘플 URL 영역 추가 (기본 정보 하단) - 출력결과 2열 레이아웃 (변수명|의미(단위)) 추가 - 공통 샘플 코드 연동 Co-Authored-By: Claude Opus 4.6 (1M context) --- .../src/pages/apihub/ApiHubServicePage.tsx | 39 +++++++++---------- frontend/src/services/apiHubService.ts | 5 +++ 2 files changed, 24 insertions(+), 20 deletions(-) diff --git a/frontend/src/pages/apihub/ApiHubServicePage.tsx b/frontend/src/pages/apihub/ApiHubServicePage.tsx index 8720384..a455ea6 100644 --- a/frontend/src/pages/apihub/ApiHubServicePage.tsx +++ b/frontend/src/pages/apihub/ApiHubServicePage.tsx @@ -1,7 +1,7 @@ import { useState, useEffect, useCallback } from 'react'; import { useParams, useNavigate } from 'react-router-dom'; import type { ServiceCatalog, ServiceApiItem } from '../../types/apihub'; -import { getCatalog } from '../../services/apiHubService'; +import { getServiceCatalog } from '../../services/apiHubService'; const METHOD_COLORS: Record = { GET: 'bg-green-100 text-green-700 dark:bg-green-900 dark:text-green-300', @@ -29,9 +29,6 @@ const HEALTH_LABEL: Record = { UNKNOWN: '알 수 없음', }; -const truncate = (str: string, max: number): string => - str.length > max ? str.slice(0, max) + '...' : str; - interface DomainSectionProps { domainName: string; apis: ServiceApiItem[]; @@ -48,14 +45,21 @@ const DomainSection = ({ domainName, apis, serviceId, onNavigate }: DomainSectio
- +
+ + + + + + + - + - + @@ -72,14 +76,14 @@ const DomainSection = ({ domainName, apis, serviceId, onNavigate }: DomainSectio {api.apiMethod} - - -
메서드메서드 경로 API명 설명상태상태
+ {api.apiPath} + {api.apiName} - {api.description ? truncate(api.description, 60) : -} + + {api.description || -} {api.isActive ? ( @@ -106,14 +110,9 @@ const ApiHubServicePage = () => { const fetchData = useCallback(async () => { if (!serviceId) return; try { - const res = await getCatalog(); + const res = await getServiceCatalog(Number(serviceId)); if (res.success && res.data) { - const found = res.data.find((s) => s.serviceId === Number(serviceId)); - if (found) { - setService(found); - } else { - setError('서비스를 찾을 수 없습니다'); - } + setService(res.data); } else { setError('서비스 정보를 불러오지 못했습니다'); } @@ -158,7 +157,7 @@ const ApiHubServicePage = () => { const domainsMap = new Map(); for (const dg of service.domains) { - const key = dg.domain || '기타'; + const key = dg.domain ? dg.domain.toUpperCase() : '기타'; domainsMap.set(key, dg.apis); } @@ -166,7 +165,7 @@ const ApiHubServicePage = () => { const domainEntries = [...domainsMap.entries()]; return ( -
+