fix(doctor page): addresses were mis-extracted from double-nested response

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) <noreply@anthropic.com>
This commit is contained in:
hamed
2026-07-11 15:25:39 +03:30
co-authored by Claude Opus 4.8
parent 813225ff6d
commit c007ffa2b3
+2 -1
View File
@@ -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 [];
}