fix: 기사 견적 API 경로 수정 및 fetchInstance 적용 - #45
Conversation
📝 WalkthroughWalkthrough견적 요청 API가 Changes견적 요청 API 전환
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/types/moverEstimateRequest.ts (1)
31-38: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win객체 응답 타입을
interface로 변경하세요.
MoverEstimateRequestListResult와RejectedEstimateRequestListResult는 객체 형태의 API 응답 타입입니다. 프로젝트 규칙에 따라type대신interface를 우선 사용하세요.변경 예시
-export type MoverEstimateRequestListResult = { +export interface MoverEstimateRequestListResult { items: MoverEstimateRequest[]; pagination: { nextCursor: string | null; hasNextPage: boolean; totalCount: number; }; -}; +} -export type RejectedEstimateRequestListResult = { +export interface RejectedEstimateRequestListResult { items: RejectedEstimateRequestItem[]; pagination: { nextCursor: string | null; hasNextPage: boolean; }; -}; +}As per coding guidelines,
interface를 우선 사용합니다.Also applies to: 91-97
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/types/moverEstimateRequest.ts` around lines 31 - 38, Change the object response declarations MoverEstimateRequestListResult and RejectedEstimateRequestListResult from type aliases to interfaces, preserving their existing properties and nested pagination shape unchanged.Sources: Coding guidelines, Path instructions
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@src/types/moverEstimateRequest.ts`:
- Around line 31-38: Change the object response declarations
MoverEstimateRequestListResult and RejectedEstimateRequestListResult from type
aliases to interfaces, preserving their existing properties and nested
pagination shape unchanged.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: 4a93f6fb-af34-4325-8323-2e5829091539
📒 Files selected for processing (2)
src/lib/api/moverEstimateRequests.tssrc/types/moverEstimateRequest.ts
|
앗 서현님 감사합니다! 근데 제가 어제부터 리팩토링을 진행하면서 커밋까지 해둔 영역이라, 변경 사항이 겹칠 것 같네요.. 어떻게 할까요 |
해당 수정사항은 추후 리팩토링 브랜치에서 반영될 예정으로 close함
📋 작업 내용
기사 견적 요청 관련 API 호출을
axiosInstance에서 프로젝트 공통fetchInstance로 전환했습니다.환경변수의 API base URL에 이미
/api가 포함되어 있어 요청 경로가/api/api/...로 생성될 수 있던 문제도 함께 수정했습니다.🔥 변경 사항
fetchInstance로 전환/api를 직접 붙이지 않고API_ROUTES.ESTIMATES의 전용 경로 상수를 사용하도록 변경REQUESTSSENDREJECTREJECTIONSfetchInstance가 공통 응답의data를 반환하고 실패 응답을ApiError로 처리하므로, 개별 API의response.data.success분기를 제거MoverEstimateRequestListResultRejectedEstimateRequestListResultSentEstimateRejectedEstimate✅ 체크리스트
📷 스크린샷 (선택)
API 클라이언트 및 요청 경로 변경으로 별도의 UI 변경은 없습니다.
💬 To Reviewer
NEXT_PUBLIC_API_BASE_URL에/api가 포함된 구성을 기준으로 하고 있기 때문에, 이에 맞게 .env 및 코드가 수정되어야 합니다. (현재 임시로 사용 중인axiosInstance에서는 경로 앞에/api를 추가하는 로직이 있는 것으로 파악되지만, 프로젝트 공통인fetchInstance는 그렇지 않습니다)fetchInstance의 응답·에러 처리 방식을 사용하도록 변경했습니다.API_ROUTES.ESTIMATES의 전용 경로 상수를 유지하면서fetchInstance전환 내용을 반영했습니다.Summary by CodeRabbit