Is there a better way of filtering data (Contentful API)
Unanswered
West African Lion posted this in #help-forum
West African LionOP
export const getStaticProps = (async () => {
const client = createClient({
space: process.env.CONTENTFUL_SPACE_ID || "",
accessToken: process.env.CONTENTFUL_ACCESS_KEY || "",
})
const res = await client.getEntries({ content_type: "rentalPropertyPage" })
const properties = res.items.map(property => {
if (property.fields.available) {
return property
}
return {
...property,
fields: {
propertyName: 'Redacted',
slug: 'Redacted',
address: 'Redacted',
available: property.fields.available,
snippet: property.fields.snippet,
price: property.fields.price,
bedrooms: property.fields.bedrooms,
bathrooms: property.fields.bathrooms,
startDate: property.fields.startDate,
propertyImages: property.fields.propertyImages,
description: property.fields.description
}
}
})
return {
props: {
properties: res.items
}
}
}) satisfies GetStaticProps
I want to show users that other properties exist, with them being able to harass existing tenets
If that makes sense, so I'm trying to remove all identifying info (address, location, etc.)