diff --git a/package.json b/package.json index 0c2951e8..b8f85f86 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "react-storefront", - "version": "7.7.2", + "version": "7.7.3", "description": "Build and deploy e-commerce progressive web apps (PWAs) in record time.", "module": "./index.js", "license": "Apache-2.0", diff --git a/src/props/fetchFromAPI.js b/src/props/fetchFromAPI.js index 1613cb16..22b48614 100644 --- a/src/props/fetchFromAPI.js +++ b/src/props/fetchFromAPI.js @@ -32,7 +32,7 @@ export default function fetchFromAPI({ req, asPath, pathname }) { if (req) { protocol = 'https://' - if (host.startsWith('localhost') || host === '127.0.0.1') { + if (host.startsWith('localhost') || host.startsWith('127.0.0.1')) { protocol = 'http://' } } @@ -59,5 +59,9 @@ export default function fetchFromAPI({ req, asPath, pathname }) { } } - return fetch(`${protocol}${host}${uri}`, { headers }).then(res => res.json()) + const url = `${protocol}${host}${uri}` + + console.log('url', url) + + return fetch(url, { headers }).then(res => res.json()) }