feat: 웹사이트 표준화 검사 도구 구현
- 4개 검사 엔진: HTML/CSS, 접근성(WCAG), SEO, 성능/보안 (총 50개 항목) - FastAPI 백엔드 (9개 API, SSE 실시간 진행, PDF/JSON 리포트) - Next.js 15 프론트엔드 (6개 페이지, 29개 컴포넌트, 반원 게이지 차트) - Docker Compose 배포 (Backend:8011, Frontend:3011, MongoDB:27022, Redis:6392) - 전체 테스트 32/32 PASS Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
57
frontend/src/lib/queries.ts
Normal file
57
frontend/src/lib/queries.ts
Normal file
@ -0,0 +1,57 @@
|
||||
import {
|
||||
useQuery,
|
||||
keepPreviousData,
|
||||
} from "@tanstack/react-query";
|
||||
import { api } from "@/lib/api";
|
||||
|
||||
/** 검사 결과 조회 */
|
||||
export function useInspectionResult(inspectionId: string | undefined) {
|
||||
return useQuery({
|
||||
queryKey: ["inspection", inspectionId],
|
||||
queryFn: () => api.getInspection(inspectionId!),
|
||||
enabled: !!inspectionId,
|
||||
staleTime: 5 * 60 * 1000,
|
||||
});
|
||||
}
|
||||
|
||||
/** 이슈 목록 조회 */
|
||||
export function useInspectionIssues(
|
||||
inspectionId: string | undefined,
|
||||
category?: string,
|
||||
severity?: string
|
||||
) {
|
||||
return useQuery({
|
||||
queryKey: ["inspection-issues", inspectionId, category, severity],
|
||||
queryFn: () =>
|
||||
api.getIssues(inspectionId!, { category, severity }),
|
||||
enabled: !!inspectionId,
|
||||
});
|
||||
}
|
||||
|
||||
/** 이력 목록 조회 (페이지네이션) */
|
||||
export function useInspectionHistory(page: number, url?: string) {
|
||||
return useQuery({
|
||||
queryKey: ["inspection-history", page, url],
|
||||
queryFn: () => api.getInspections({ page, limit: 20, url }),
|
||||
placeholderData: keepPreviousData,
|
||||
});
|
||||
}
|
||||
|
||||
/** 트렌드 데이터 조회 */
|
||||
export function useInspectionTrend(url: string | undefined) {
|
||||
return useQuery({
|
||||
queryKey: ["inspection-trend", url],
|
||||
queryFn: () => api.getTrend(url!),
|
||||
enabled: !!url,
|
||||
staleTime: 10 * 60 * 1000,
|
||||
});
|
||||
}
|
||||
|
||||
/** 최근 검사 이력 (메인 페이지용, 5건) */
|
||||
export function useRecentInspections() {
|
||||
return useQuery({
|
||||
queryKey: ["recent-inspections"],
|
||||
queryFn: () => api.getInspections({ page: 1, limit: 5 }),
|
||||
staleTime: 60 * 1000,
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user