Commit 23f9e254 authored by Rodrigo Tapia-McClung's avatar Rodrigo Tapia-McClung

Fix baseUrl for localhost or server instances

parent f451e38f
...@@ -37,7 +37,10 @@ let regions = { ...@@ -37,7 +37,10 @@ let regions = {
previousClick, previousClick,
currentClick; currentClick;
const baseUrl = new URL(window.location.href).origin; // returns "http://localhost:8090" const windowUrl = new URL(window.location.href);
const baseUrl = windowUrl.hostname == "localhost" ?
`${windowUrl.origin}` : // returns "http://localhost:8090"
`${windowUrl.origin}/fordecyt_2019`; // returns "http://servername/fordecyt_2019"
// use `${baseUrl}/something` // use `${baseUrl}/something`
let timeParse = d3.timeParse("%Y"); let timeParse = d3.timeParse("%Y");
......
...@@ -63,7 +63,10 @@ d3.json("https://unpkg.com/d3-time-format@2.1.1/locale/es-MX.json").then(async l ...@@ -63,7 +63,10 @@ d3.json("https://unpkg.com/d3-time-format@2.1.1/locale/es-MX.json").then(async l
const sortInitialDateAscending = (a, b) => a - b; const sortInitialDateAscending = (a, b) => a - b;
// Dates will be cast to numbers automagically: // Dates will be cast to numbers automagically:
const baseUrl = new URL(window.location.href).origin; // returns "http://localhost:8090" const windowUrl = new URL(window.location.href);
const baseUrl = windowUrl.hostname == "localhost" ?
`${windowUrl.origin}` : // returns "http://localhost:8090"
`${windowUrl.origin}/fordecyt_2019`; // returns "http://servername/fordecyt_2019"
// use `${baseUrl}/something` // use `${baseUrl}/something`
// query available dates on DB // query available dates on DB
......
...@@ -17,7 +17,10 @@ let timeDimensionControl, ...@@ -17,7 +17,10 @@ let timeDimensionControl,
layerControl, layerControl,
tiles; tiles;
const baseUrl = new URL(window.location.href).origin; // returns "http://localhost:8090" const windowUrl = new URL(window.location.href);
const baseUrl = windowUrl.hostname == "localhost" ?
`${windowUrl.origin}` : // returns "http://localhost:8090"
`${windowUrl.origin}/fordecyt_2019`; // returns "http://servername/fordecyt_2019"
// use `${baseUrl}/something` // use `${baseUrl}/something`
const getMinMax = table => { const getMinMax = table => {
......
...@@ -96,8 +96,11 @@ const sortInitialDateAscending = (a, b) => { ...@@ -96,8 +96,11 @@ const sortInitialDateAscending = (a, b) => {
return a - b; return a - b;
} }
const baseUrl = new URL(window.location.href).origin; // returns "http://localhost:8090" const windowUrl = new URL(window.location.href);
// use `${baseUrl}/something` const baseUrl = windowUrl.hostname == "localhost" ?
`${windowUrl.origin}` : // returns "http://localhost:8090"
`${windowUrl.origin}/fordecyt_2019`; // returns "http://servername/fordecyt_2019"
// use `${baseUrl}/something`
// query available dates on DB // query available dates on DB
const setupDates = () => { const setupDates = () => {
......
...@@ -96,7 +96,10 @@ const sortInitialDateAscending = (a, b) => { ...@@ -96,7 +96,10 @@ const sortInitialDateAscending = (a, b) => {
return a - b; return a - b;
} }
const baseUrl = new URL(window.location.href).origin; // returns "http://localhost:8090" const windowUrl = new URL(window.location.href);
const baseUrl = windowUrl.hostname == "localhost" ?
`${windowUrl.origin}` : // returns "http://localhost:8090"
`${windowUrl.origin}/fordecyt_2019`; // returns "http://servername/fordecyt_2019"
// use `${baseUrl}/something` // use `${baseUrl}/something`
// query available dates on DB // query available dates on DB
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment