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