Skip to content

Commit 9f5c88d

Browse files
committed
fixed an issue with fetchFromAPI when fetching from 127.0.0.1
1 parent cdabb44 commit 9f5c88d

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-storefront",
3-
"version": "7.7.2",
3+
"version": "7.7.3",
44
"description": "Build and deploy e-commerce progressive web apps (PWAs) in record time.",
55
"module": "./index.js",
66
"license": "Apache-2.0",

src/props/fetchFromAPI.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ export default function fetchFromAPI({ req, asPath, pathname }) {
3232
if (req) {
3333
protocol = 'https://'
3434

35-
if (host.startsWith('localhost') || host === '127.0.0.1') {
35+
if (host.startsWith('localhost') || host.startsWith('127.0.0.1')) {
3636
protocol = 'http://'
3737
}
3838
}
@@ -59,5 +59,9 @@ export default function fetchFromAPI({ req, asPath, pathname }) {
5959
}
6060
}
6161

62-
return fetch(`${protocol}${host}${uri}`, { headers }).then(res => res.json())
62+
const url = `${protocol}${host}${uri}`
63+
64+
console.log('url', url)
65+
66+
return fetch(url, { headers }).then(res => res.json())
6367
}

0 commit comments

Comments
 (0)