Skip to content
Snippets Groups Projects

Update: Read API Hostname from LocalStorage

1 file
+ 4
0
Compare changes
  • Side-by-side
  • Inline
+ 4
0
@@ -45,6 +45,10 @@ if (typeof window !== 'undefined') {
@@ -45,6 +45,10 @@ if (typeof window !== 'undefined') {
}
}
const getHostName = () => {
const getHostName = () => {
 
const localStorageHostName = typeof window !== 'undefined' ? localStorage.getItem('coscine.api.hostname') : null;
 
if(localStorageHostName){
 
return localStorageHostName;
 
}
let hostName = typeof window !== 'undefined' ? window.location.hostname : 'coscine.rwth-aachen.de';
let hostName = typeof window !== 'undefined' ? window.location.hostname : 'coscine.rwth-aachen.de';
if (hostName.indexOf(':') !== -1) {
if (hostName.indexOf(':') !== -1) {
if (hostName.indexOf('https://') !== -1) {
if (hostName.indexOf('https://') !== -1) {
Loading