14 lines
326 B
JavaScript
14 lines
326 B
JavaScript
|
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}.`));
|
||
|
}
|