From 48058d0a008035377f3fb6156038bbb601152f6b Mon Sep 17 00:00:00 2001 From: onohesey Date: Wed, 3 Jun 2026 16:36:32 +0900 Subject: [PATCH] =?UTF-8?q?fix(profile):=20=ED=94=84=EB=A1=9C=ED=95=84?= =?UTF-8?q?=EC=A0=84=ED=99=98=EC=8B=9C=20petid=EC=97=90=20=EB=A7=9E?= =?UTF-8?q?=EA=B2=8C=20=EB=8B=A4=EB=A5=B8=20=ED=99=94=EB=A9=B4=EB=93=A4?= =?UTF-8?q?=EB=8F=84=20=EC=A0=84=ED=99=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/app/api/profile.ts | 5 ++++- frontend/src/app/components/HealthLogScreen.tsx | 2 +- frontend/src/app/components/PetProfileScreen.tsx | 6 +----- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/frontend/src/app/api/profile.ts b/frontend/src/app/api/profile.ts index 6eca42d..3100627 100644 --- a/frontend/src/app/api/profile.ts +++ b/frontend/src/app/api/profile.ts @@ -1,5 +1,6 @@ const API_BASE = import.meta.env.VITE_API_BASE_URL; const TOKEN_KEY = 'hyfive_token'; +const PET_ID_KEY = 'hyfive_petId'; // ── Types ────────────────────────────────────────────────────────────────────── @@ -143,5 +144,7 @@ export async function activatePet(petId: number): Promise { method: 'PATCH', headers: authHeaders(), }); - return parse(res); + const pet = await parse(res); + localStorage.setItem(PET_ID_KEY, String(petId)); + return pet; } \ No newline at end of file diff --git a/frontend/src/app/components/HealthLogScreen.tsx b/frontend/src/app/components/HealthLogScreen.tsx index 757b7af..5d47b30 100644 --- a/frontend/src/app/components/HealthLogScreen.tsx +++ b/frontend/src/app/components/HealthLogScreen.tsx @@ -15,7 +15,7 @@ import { type FecalState = '정상' | '무름' | '딱딱함' | '혈변' | '없음'; -const CURRENT_PET_ID = 1; +const CURRENT_PET_ID = Number(localStorage.getItem('hyfive_petId') ?? '1'); const FECAL_TO_API: Record = { '정상': 'NORMAL', '무름': 'SOFT', '딱딱함': 'HARD', '혈변': 'BLOOD', '없음': 'NONE', diff --git a/frontend/src/app/components/PetProfileScreen.tsx b/frontend/src/app/components/PetProfileScreen.tsx index 4824439..e005b78 100644 --- a/frontend/src/app/components/PetProfileScreen.tsx +++ b/frontend/src/app/components/PetProfileScreen.tsx @@ -254,12 +254,8 @@ export default function PetProfileScreen() { {/* Vaccine / Prevention */}
-
+

예방접종 · 투약 현황

-
{vaccineRecords.map((v, i) => (