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>
|
<p className="text-[#E7EEF6] text-[20px] font-semibold">آدرس:</p>
|
||||||
</div>
|
</div>
|
||||||
<p className="text-[#E7EEF6] text-[16px] !font-normal mt-[16px] text-right">
|
<p className="text-[#E7EEF6] text-[16px] !font-normal mt-[16px] text-right">
|
||||||
{data?.address[0]?.address}
|
{data?.address?.[0]?.address}
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -3,14 +3,14 @@ import TelefonPoster from "@/components/icons/TelefonPoster";
|
|||||||
function Telefon({ data }) {
|
function Telefon({ data }) {
|
||||||
return (
|
return (
|
||||||
<div
|
<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]">
|
<div className="flex items-center justify-start gap-[6px]">
|
||||||
<TelefonPoster />
|
<TelefonPoster />
|
||||||
<p className="text-[#E7EEF6] text-[20px] font-semibold">تلفن:</p>
|
<p className="text-[#E7EEF6] text-[20px] font-semibold">تلفن:</p>
|
||||||
</div>
|
</div>
|
||||||
<p className="text-[#E7EEF6] text-[16px] font-normal mt-[16px]">
|
<p className="text-[#E7EEF6] text-[16px] font-normal mt-[16px]">
|
||||||
{data?.address[0]?.phone}
|
{data?.address?.[0]?.phone}
|
||||||
</p>
|
</p>
|
||||||
{data?.address &&
|
{data?.address &&
|
||||||
data?.address.length > 1 &&
|
data?.address.length > 1 &&
|
||||||
|
|||||||
Reference in New Issue
Block a user