This commit is contained in:
@ -228,18 +228,20 @@ export default function PropertyDetailsPage() {
|
|||||||
getMySaleListings(),
|
getMySaleListings(),
|
||||||
]);
|
]);
|
||||||
const myPropIds = new Set();
|
const myPropIds = new Set();
|
||||||
const addIds = (items) => {
|
const collectIds = (result) => {
|
||||||
if (!Array.isArray(items)) return;
|
if (result.status !== 'fulfilled' || !result.value) return;
|
||||||
items.forEach(p => {
|
const list = Array.isArray(result.value) ? result.value : [result.value];
|
||||||
|
list.forEach(p => {
|
||||||
const info = p.propertyInformation || {};
|
const info = p.propertyInformation || {};
|
||||||
if (info.id) myPropIds.add(info.id);
|
if (info.id) myPropIds.add(Number(info.id));
|
||||||
if (p.id) myPropIds.add(p.id);
|
if (p.id) myPropIds.add(Number(p.id));
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
if (myRent.status === 'fulfilled') addIds(myRent.value);
|
collectIds(myRent);
|
||||||
if (mySale.status === 'fulfilled') addIds(mySale.value);
|
collectIds(mySale);
|
||||||
const propInfoId = mapped._raw?.propertyInformationId || mapped.id;
|
const checkId = Number(mapped.id) || mapped.id;
|
||||||
if (myPropIds.has(propInfoId) || myPropIds.has(mapped.id)) {
|
const checkInfoId = Number(mapped._raw?.propertyInformation?.id) || mapped._raw?.propertyInformation?.id;
|
||||||
|
if (myPropIds.has(checkId) || (checkInfoId && myPropIds.has(checkInfoId))) {
|
||||||
setIsOwnProperty(true);
|
setIsOwnProperty(true);
|
||||||
}
|
}
|
||||||
} catch {}
|
} catch {}
|
||||||
|
|||||||
Reference in New Issue
Block a user