Filters done
This commit is contained in:
@@ -4,18 +4,24 @@ export const loadProperties = ({
|
||||
bounds,
|
||||
minPrice = '',
|
||||
maxPrice = '',
|
||||
minSize = '',
|
||||
maxSize = '',
|
||||
rooms
|
||||
minSize = '',
|
||||
maxSize = '',
|
||||
rooms = {},
|
||||
category = {}
|
||||
}) => {
|
||||
const allRooms = Object
|
||||
.keys(rooms)
|
||||
.filter((v) => rooms[v])
|
||||
.join(',');
|
||||
|
||||
const allCategories = Object
|
||||
.keys(category)
|
||||
.filter((v) => category[v])
|
||||
.join(',');
|
||||
|
||||
// TODO: handle errors
|
||||
//return fetch(process.env.API_URL + '/api/search', {
|
||||
return fetch(`http://localhost:3001/api/search?bounds=${bounds}&minPrice=${minPrice}&maxPrice=${maxPrice}&rooms=${allRooms}&minSize=${minSize}&maxSize=${maxSize}`, {
|
||||
return fetch(`http://localhost:3001/api/search?bounds=${bounds}&minPrice=${minPrice}&maxPrice=${maxPrice}&rooms=${allRooms}&minSize=${minSize}&maxSize=${maxSize}&category=${allCategories}`, {
|
||||
//credentials: 'include'
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user