Update fetch.js

Fixed for running over HTTPS
This commit is contained in:
Donald Zou 2024-08-14 10:57:41 -04:00
parent a30843cff9
commit 0489dc7c33

View File

@ -19,7 +19,8 @@ const getUrl = (url) => {
if (apiKey){
return `${apiKey.host}${url}`
}
return `//${window.location.host}${window.location.pathname}${url}`
return window.location.hostname === 'localhost' ? url
: `${window.location.protocol}//${window.location.host}${window.location.pathname}${url}`
}
export const fetchGet = async (url, params=undefined, callback=undefined) => {