Files
nobat724_front/app/component/comment/index.js
T
hamedandClaude Opus 4.8 ff54daf1ae fix(doctor): unwrap double-nested API response and guard empty sections
The GET /api/v1/doctor/{uuid} response is double-nested
({ success, data: { data: {...} } }), but the page only unwrapped one
level, leaving every field (name, specialties, expertise, address)
undefined — so خدمات / موقعیت مکانی / نظرات rendered empty or broken.

- Extract the doctor object with res.data?.data?.data in both
  generateMetadata and the page.
- Hide the خدمات block when expertise is empty (no fabricated data).
- Render the location map iframe and routing buttons only when the
  address has real latitude/longitude (was building q=null,null).
- Fix the comments list rendering a stray 0 on empty arrays.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-15 15:18:06 +03:30

28 lines
612 B
JavaScript

"use client";
import { useState } from "react";
import ItemUser from "./ItemUser";
function Comment({ comments }) {
const [update, setUpdate] = useState(false);
return (
<ul
className={`flex flex-col comment-list !pl-2.5 justify-start max-h-[492px] overflow-auto items-start gap-12 mt-2 ${
false && "w-full"
}`}
>
{comments?.length > 0 &&
comments.map((item, idx) => (
<ItemUser
key={idx}
data={item}
update={update}
setUpdate={setUpdate}
/>
))}
</ul>
);
}
export default Comment;