diff --git a/app/property/[id]/PropertyDetail.js b/app/property/[id]/PropertyDetail.js index fad636c..ebd59ad 100644 --- a/app/property/[id]/PropertyDetail.js +++ b/app/property/[id]/PropertyDetail.js @@ -226,11 +226,14 @@ export default function PropertyDetailsPage() { try { const myRent = await getMyRentListings(); const list = Array.isArray(myRent) ? myRent : (myRent ? [myRent] : []); - const myPropIds = new Set(list.map(p => { + const myPropIds = new Set(); + list.filter(Boolean).forEach(p => { const info = p.propertyInformation || {}; - return Number(info.id || p.id); - })); - if (myPropIds.has(Number(mapped._raw?.propertyInformation?.id || mapped.id))) { + if (info.id) myPropIds.add(Number(info.id)); + if (p.id) myPropIds.add(Number(p.id)); + }); + const propInfoId = mapped._raw?.propertyInformation?.id; + if (myPropIds.has(Number(mapped.id)) || (propInfoId && myPropIds.has(Number(propInfoId)))) { setIsOwnProperty(true); } } catch (e) { @@ -792,16 +795,6 @@ export default function PropertyDetailsPage() { {/* Sidebar */}
isOwnProperty: {String(isOwnProperty)}
-authenticated: {String(AuthService.isAuthenticated())} | isOwner: {String(AuthService.isOwner())}
-