From c007ffa2b3f1da719f1fdac0c4ba7b11788850bc Mon Sep 17 00:00:00 2001 From: hamed <15238-genius.ha@users.noreply.drupalcode.org> Date: Sat, 11 Jul 2026 15:25:39 +0330 Subject: [PATCH] fix(doctor page): addresses were mis-extracted from double-nested response MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit GET /api/v1/clinic-pro/doctor-addresses/{id} returns { data: { data: [...] } }, but getDoctorAddresses read json.data (the wrapper object, not the array), so addresses.length/.map were undefined — the locations card + map never rendered even when the doctor had an address. Extract json.data.data. Co-Authored-By: Claude Opus 4.8 (1M context) --- app/doctor/[slug]/page.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/doctor/[slug]/page.js b/app/doctor/[slug]/page.js index 746faf8..c572d8b 100644 --- a/app/doctor/[slug]/page.js +++ b/app/doctor/[slug]/page.js @@ -29,7 +29,8 @@ const getDoctorAddresses = cache(async (doctorId) => { }); if (!res.ok) return []; const json = await res.json(); - return json?.data ?? []; + // پاسخ double-nested است: { success, data: { data: [...] } } + return json?.data?.data ?? json?.data ?? []; } catch { return []; }