Commit c084626a authored by Rodrigo Tapia-McClung's avatar Rodrigo Tapia-McClung

Fix API call base URLs

parent f0a41af8
......@@ -27,7 +27,7 @@ const getData = async () => {
});
const userFilePromises = userFiles.map( async monthYear => {
let queryDB = `http://localhost:8090/data/query/${monthYear}?columns=${queryColumns.join(",")}`;
let queryDB = `../data/query/${monthYear}?columns=${queryColumns.join(",")}`;
const dbData = await d3.json(queryDB);
return {date: timeParse(monthYear), value: dbData[0]};
});
......@@ -67,7 +67,7 @@ const getDataInSelection = async () => {
let filter = `ST_Intersects(geom, (SELECT ST_Multi(ST_GeomFromGeoJSON('${JSON.stringify(geojson.features[i].geometry)}') ) ) )`
const userFilePromises = userFiles.map(async monthYear => {
let queryData = `http://localhost:8090/data/query/${monthYear}?columns=${queryColumns.join(",")}&filter=${filter}&group=1%3D1`;
let queryData = `../data/query/${monthYear}?columns=${queryColumns.join(",")}&filter=${filter}&group=1%3D1`;
const selectionQuery = await d3.json(queryData);
return {date: timeParse(monthYear), value: selectionQuery[0]};
});
......
......@@ -99,7 +99,7 @@ const sortInitialDateAscending = (a, b) => {
// query available dates on DB
const setupDates = () => {
return new Promise( resolve => {
let layersQuery = "http://localhost:8090/data/list_layers";
let layersQuery = "../data/list_layers";
d3.json(layersQuery).then(layers => {
layers.forEach(layer => {
dateArray.push(timeParse(layer.f_table_name)); // convert filenames to dates
......@@ -331,7 +331,7 @@ const queryFiles = () => {
const getMinMax = table => {
return new Promise( resolve => {
let minmaxQuery = `http://localhost:8090/data/query/${table}?columns=${cols.join(", ")}`;
let minmaxQuery = `../data/query/${table}?columns=${cols.join(", ")}`;
d3.json(minmaxQuery).then( minmax => {
resolve(minmax[0]);
});
......@@ -526,11 +526,12 @@ const updateCharts = async () => {
// define MVT layer for given month table and all indicators
const mapboxLayer = (monthYear) => {
const baseUrl = new URL(`/data`, window.location.href).href;
let pbfLayer = {
id: monthYear,
source: {
type: "vector",
tiles: [`http://localhost:8090/data/${monthYear}/mvt/{z}/{x}/{y}?geom_column=geom&columns=${indicators.join()}`],
tiles: [`${baseUrl}/${monthYear}/mvt/{z}/{x}/{y}?geom_column=geom&columns=${indicators.join()}`],
maxzoom: 14,
minzoom: 5
},
......
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