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:
@@ -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 [];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user