fix(doctor): guard optional chaining on address array
برخی پزشکان address ندارند؛ data?.address[0] روی آنها کرش میکرد (Cannot read properties of undefined). اصلاح به data?.address?.[0] در Address و Telefon صفحه پروفایل پزشک. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -8,7 +8,7 @@ function Address({ data }) {
|
||||
<p className="text-[#E7EEF6] text-[20px] font-semibold">آدرس:</p>
|
||||
</div>
|
||||
<p className="text-[#E7EEF6] text-[16px] !font-normal mt-[16px] text-right">
|
||||
{data?.address[0]?.address}
|
||||
{data?.address?.[0]?.address}
|
||||
</p>
|
||||
</div>
|
||||
);
|
||||
|
||||
@@ -3,14 +3,14 @@ import TelefonPoster from "@/components/icons/TelefonPoster";
|
||||
function Telefon({ data }) {
|
||||
return (
|
||||
<div
|
||||
className={`flex-col items-start justify-start mt-[40px] ${data?.address[0]?.phone ? "flex" : "hidden"}`}
|
||||
className={`flex-col items-start justify-start mt-[40px] ${data?.address?.[0]?.phone ? "flex" : "hidden"}`}
|
||||
>
|
||||
<div className="flex items-center justify-start gap-[6px]">
|
||||
<TelefonPoster />
|
||||
<p className="text-[#E7EEF6] text-[20px] font-semibold">تلفن:</p>
|
||||
</div>
|
||||
<p className="text-[#E7EEF6] text-[16px] font-normal mt-[16px]">
|
||||
{data?.address[0]?.phone}
|
||||
{data?.address?.[0]?.phone}
|
||||
</p>
|
||||
{data?.address &&
|
||||
data?.address.length > 1 &&
|
||||
|
||||
Reference in New Issue
Block a user