Files
dognation_PT/src/api/spots.ts
T
sb 56255c0ae6
CI / build (push) Failing after 13m34s
feat: 체크인 후 AI 궁합 추천 표시
체크인 성공 시 /api/spots/{id}/ai-mates 를 호출해 사이좋게 지낼 만한
강아지를 궁합점수·이유와 함께 표시. 로딩 스피너·빈 상태 처리 포함.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-11 13:44:46 +09:00

50 lines
1.2 KiB
TypeScript

import { http } from './http'
export interface Spot {
id: number
name: string
type: string
latitude: number | null
longitude: number | null
}
export interface Mate {
dogId: number
name: string
breed: string | null
}
export interface AiMate {
dogId: number
name: string
breed: string | null
score: number
reason: string
}
export interface Review {
id: number
tag: string | null
content: string | null
createdAt: string
}
export interface CheckInResult {
id: number
spotId: number
dogId: number
expiresAt: string
}
export const spotsApi = {
list: () => http.get<Spot[]>('/api/spots'),
mates: (spotId: number) => http.get<Mate[]>(`/api/spots/${spotId}/mates`),
aiMates: (spotId: number, dogId: number) =>
http.get<AiMate[]>(`/api/spots/${spotId}/ai-mates?dogId=${dogId}`),
reviews: (spotId: number) => http.get<Review[]>(`/api/spots/${spotId}/reviews`),
checkIn: (spotId: number, userId: number, dogId: number) =>
http.post<CheckInResult>(`/api/spots/${spotId}/checkins`, { userId, dogId }),
addReview: (spotId: number, userId: number, tag: string) =>
http.post<Review>(`/api/spots/${spotId}/reviews`, { userId, tag }),
}