This commit is contained in:
@ -226,11 +226,14 @@ export default function PropertyDetailsPage() {
|
|||||||
try {
|
try {
|
||||||
const myRent = await getMyRentListings();
|
const myRent = await getMyRentListings();
|
||||||
const list = Array.isArray(myRent) ? myRent : (myRent ? [myRent] : []);
|
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 || {};
|
const info = p.propertyInformation || {};
|
||||||
return Number(info.id || p.id);
|
if (info.id) myPropIds.add(Number(info.id));
|
||||||
}));
|
if (p.id) myPropIds.add(Number(p.id));
|
||||||
if (myPropIds.has(Number(mapped._raw?.propertyInformation?.id || mapped.id))) {
|
});
|
||||||
|
const propInfoId = mapped._raw?.propertyInformation?.id;
|
||||||
|
if (myPropIds.has(Number(mapped.id)) || (propInfoId && myPropIds.has(Number(propInfoId)))) {
|
||||||
setIsOwnProperty(true);
|
setIsOwnProperty(true);
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
@ -792,16 +795,6 @@ export default function PropertyDetailsPage() {
|
|||||||
|
|
||||||
{/* Sidebar */}
|
{/* Sidebar */}
|
||||||
<div className="space-y-4">
|
<div className="space-y-4">
|
||||||
{/* Debug: Owner Check Info */}
|
|
||||||
{typeof window !== 'undefined' && (
|
|
||||||
<details className="bg-red-50 p-2 rounded-xl text-[10px] text-red-700 border border-red-200">
|
|
||||||
<summary className="cursor-pointer font-bold">🔍 Owner Debug</summary>
|
|
||||||
<div className="mt-1 space-y-0.5">
|
|
||||||
<p>isOwnProperty: <b>{String(isOwnProperty)}</b></p>
|
|
||||||
<p>authenticated: <b>{String(AuthService.isAuthenticated())}</b> | isOwner: <b>{String(AuthService.isOwner())}</b></p>
|
|
||||||
</div>
|
|
||||||
</details>
|
|
||||||
)}
|
|
||||||
{/* Booking Card */}
|
{/* Booking Card */}
|
||||||
{property.isRent && (
|
{property.isRent && (
|
||||||
<motion.div initial={{ opacity: 0, x: 20 }} animate={{ opacity: 1, x: 0 }} className="bg-white rounded-2xl p-5 shadow-sm border border-gray-200 sticky top-6">
|
<motion.div initial={{ opacity: 0, x: 20 }} animate={{ opacity: 1, x: 0 }} className="bg-white rounded-2xl p-5 shadow-sm border border-gray-200 sticky top-6">
|
||||||
|
|||||||
Reference in New Issue
Block a user