To achieve the desired outcome of converting occupancy_type.is_buy into a string "sale", you can modify the logic within your handleSearch function. Here's how you can do it:
let occupancyTypeString = '';
if ( is_property_scouting_score > 7 && is_find_agent_score > 9 ) {
setSearchResult(response.content);
if (occupancy_type.is_buy) {
occupancyTypeString = 'sale';
}
}
else {
setSearchResult('Conditions not met');
}
console.log(occupancyTypeString);