1
0
mirror of https://github.com/donaldzou/WGDashboard.git synced 2024-11-06 16:00:28 +01:00

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){ if (apiKey){
return `${apiKey.host}${url}` 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) => { export const fetchGet = async (url, params=undefined, callback=undefined) => {