Files
old-kivi/web/lib/api.js

26 lines
605 B
JavaScript
Raw Normal View History

2017-03-31 14:31:56 +02:00
import fetch from 'isomorphic-fetch';
2017-04-04 04:36:52 +02:00
export const loadProperties = ({
bounds,
minPrice = '',
maxPrice = '',
2017-04-05 00:14:30 +02:00
minSize = '',
maxSize = '',
2017-04-04 04:36:52 +02:00
rooms
}) => {
const allRooms = Object
.keys(rooms)
.filter((v) => rooms[v])
.join(',');
2017-03-31 14:31:56 +02:00
// TODO: handle errors
//return fetch(process.env.API_URL + '/api/search', {
2017-04-05 00:14:30 +02:00
return fetch(`http://localhost:3001/api/search?bounds=${bounds}&minPrice=${minPrice}&maxPrice=${maxPrice}&rooms=${allRooms}&minSize=${minSize}&maxSize=${maxSize}`, {
2017-03-31 14:31:56 +02:00
//credentials: 'include'
});
//const body = await res.text();
//return JSON.parse(body);
}