import fetch from 'isomorphic-fetch'; export const loadProperties = ({ bounds, minPrice = '', maxPrice = '', 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}&category=${allCategories}`, { //credentials: 'include' }); //const body = await res.text(); //return JSON.parse(body); }