feat: 강아지 관리 화면 (프로필 CRUD + 댕비티아이 편집)
- dogs 스토어: 내 강아지 로드/등록/수정/삭제, 대표견(currentDog) - ProfilePage: 강아지 등록/선택/삭제, 성향 태그 편집·저장, 회원 티어 표시 - HomePage 체크인/매칭 주체를 대표견으로 전환(미등록 시 안내) - http 클라이언트 put/del 추가, 임시 session 스토어 제거 - 로그아웃 시 강아지 상태 리셋, Dialog 플러그인 등록 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
+15
-6
@@ -74,16 +74,16 @@ import { useQuasar } from 'quasar'
|
||||
import { spotsApi, type Mate, type Review, type Spot } from '@/api/spots'
|
||||
import { matchesApi } from '@/api/matches'
|
||||
import { ApiError } from '@/api/http'
|
||||
import { useSessionStore } from '@/stores/session'
|
||||
import { useAuthStore } from '@/stores/auth'
|
||||
import { useDogsStore } from '@/stores/dogs'
|
||||
import NaverMap from '@/components/NaverMap.vue'
|
||||
|
||||
const $q = useQuasar()
|
||||
const session = useSessionStore()
|
||||
const auth = useAuthStore()
|
||||
const dogs = useDogsStore()
|
||||
|
||||
// 체크인/매칭 주체: 로그인한 회원. 강아지 ID 는 아직 견 관리 API 전이라 세션 기본값 사용.
|
||||
const currentUserId = () => auth.member?.id ?? session.userId
|
||||
// 체크인/매칭 주체: 로그인 회원 + 대표 강아지
|
||||
const currentUserId = () => auth.member?.id ?? 0
|
||||
|
||||
const spots = ref<Spot[]>([])
|
||||
const currentSpot = ref<Spot | null>(null)
|
||||
@@ -99,6 +99,7 @@ onMounted(load)
|
||||
async function load() {
|
||||
loadError.value = false
|
||||
try {
|
||||
await dogs.loadMyDogs()
|
||||
spots.value = await spotsApi.list()
|
||||
currentSpot.value = spots.value[0] ?? null
|
||||
if (currentSpot.value) {
|
||||
@@ -126,9 +127,13 @@ async function refreshSpot(spotId: number) {
|
||||
|
||||
async function onCheckIn() {
|
||||
if (!currentSpot.value) return
|
||||
if (dogs.currentDogId == null) {
|
||||
$q.notify({ color: 'warning', message: '먼저 우리 개를 등록해 주세요.', icon: 'pets', position: 'top' })
|
||||
return
|
||||
}
|
||||
checkingIn.value = true
|
||||
try {
|
||||
await spotsApi.checkIn(currentSpot.value.id, currentUserId(), session.dogId)
|
||||
await spotsApi.checkIn(currentSpot.value.id, currentUserId(), dogs.currentDogId)
|
||||
checkedIn.value = true
|
||||
await refreshSpot(currentSpot.value.id)
|
||||
$q.notify({ color: 'primary', message: '체크인 완료! 스팟 채팅이 열렸어요.', icon: 'place', position: 'top' })
|
||||
@@ -140,9 +145,13 @@ async function onCheckIn() {
|
||||
}
|
||||
|
||||
async function onMatch(mate: Mate) {
|
||||
if (dogs.currentDogId == null) {
|
||||
$q.notify({ color: 'warning', message: '먼저 우리 개를 등록해 주세요.', icon: 'pets', position: 'top' })
|
||||
return
|
||||
}
|
||||
matchingDogId.value = mate.dogId
|
||||
try {
|
||||
await matchesApi.create(session.dogId, mate.dogId)
|
||||
await matchesApi.create(dogs.currentDogId, mate.dogId)
|
||||
$q.notify({ color: 'positive', message: `${mate.name}에게 매칭을 신청했어요!`, icon: 'favorite', position: 'top' })
|
||||
} catch (e) {
|
||||
notifyError(e)
|
||||
|
||||
Reference in New Issue
Block a user