food/src/api/index.js

14 lines
326 B
JavaScript
Raw Normal View History

2017-09-19 04:28:26 +02:00
require('es6-promise').polyfill();
require('isomorphic-fetch');
/**
* TODO
*/
export default function (EAN) {
return fetch(
`https://world.openfoodfacts.org/api/v0/product/${EAN}.json`,
)
.then(response => response.json())
.catch(exc => console.error(`Unable to fetch product: ${exc}.`));
}