fix(doctor): 404 deactivated doctor profile page

Deactivated doctors are now absent from the public list, but their
/doctor/{uuid} page still loaded. getDoctor() now treats the backend's
raw `is_active === false` as not-found, so the profile 404s like the
list — matching the site's "hide inactive doctors" behavior.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
hamed
2026-07-23 19:39:38 +03:30
co-authored by Claude Opus 4.8
parent ccbd028fee
commit cd32f6c8bd
+5 -1
View File
@@ -22,7 +22,11 @@ const getDoctor = cache(async (slug) => {
if (res.status === 404 || res.status === 400) return null;
if (!res.ok) throw new Error(`Failed to fetch doctor: ${res.status}`);
const json = await res.json();
return json?.data?.data ?? null;
const doctor = json?.data?.data ?? null;
// پزشک غیرفعال (ادمین فلگ فعال را خاموش کرده) نباید در سایت نمایش داده شود؛
// صفحهٔ تکی هم مثل لیست عمومی 404 می‌شود.
if (doctor?.is_active === false) return null;
return doctor;
});
const getDoctorAddresses = cache(async (doctorId) => {