fix: ensure protocol is the same to avoid mixed content
This commit is contained in:
parent
b1c1abeb9f
commit
20cc8479db
1 changed files with 3 additions and 2 deletions
|
@ -29,11 +29,12 @@ export default function useCachedResources(): IReturnProps {
|
|||
useEffect(() => {
|
||||
const hostname = window.location.hostname;
|
||||
const port = window.location.port;
|
||||
const protocol = window.location.protocol;
|
||||
|
||||
if (!port) {
|
||||
setBaseUrl(`http://${hostname}/api`);
|
||||
setBaseUrl(`${protocol}://${hostname}/api`);
|
||||
} else {
|
||||
setBaseUrl(`http://${hostname}:${port}/api`);
|
||||
setBaseUrl(`${protocol}//${hostname}:${port}/api`);
|
||||
}
|
||||
}, [setBaseUrl]);
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue