feat: 백엔드 API 연동 (HTTP 클라이언트 + 홈 화면 실데이터)
- VITE_API_BASE_URL 기반 fetch 클라이언트 및 ApiError 처리 - api/spots, api/matches 타입드 모듈 - HomePage: 스팟/한줄평/메이트 실제 로드, 체크인·매칭 신청 API 연동 - 임시 세션 스토어(인증 도입 전, userId/dogId) - 로딩/에러/빈 상태 처리 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
import { http } from './http'
|
||||
|
||||
export interface Match {
|
||||
id: number
|
||||
requesterDogId: number
|
||||
targetDogId: number
|
||||
status: string
|
||||
createdAt: string
|
||||
respondedAt: string | null
|
||||
}
|
||||
|
||||
export const matchesApi = {
|
||||
create: (requesterDogId: number, targetDogId: number) =>
|
||||
http.post<Match>('/api/matches', { requesterDogId, targetDogId }),
|
||||
accept: (id: number) => http.post<Match>(`/api/matches/${id}/accept`),
|
||||
reject: (id: number) => http.post<Match>(`/api/matches/${id}/reject`),
|
||||
received: (dogId: number) => http.get<Match[]>(`/api/matches/received/${dogId}`),
|
||||
}
|
||||
Reference in New Issue
Block a user