Commit 0b3c85a2 authored by alain's avatar alain 💾

api endoint based on env

parent 11407f15
import { addMissingDataPoints } from "../../data-on-a-map-app/src/util/data"
const endPointDataPlatform = process.env.NODE_ENV === 'development' ? "http://localhost:1886" : "https://data.waag.org"
export default {
name: "holu",
sides: 24,
......@@ -39,7 +41,7 @@ export default {
all: async function(parameter) {
try {
const allResponse = await fetch(`https://data.waag.org/api/muv/getCalibratedStations`)
const allResponse = await fetch(`${endPointDataPlatform}/api/muv/getCalibratedStations`)
const all = await allResponse.json()
const latestRawResponse = await fetch(`https://data.waag.org/api/getAllSensors`)
......@@ -149,7 +151,7 @@ export default {
if(parameter === "pm25" || parameter === "pm10") {
let rawURL = `https://data.waag.org/api/getHourlyValuesSensor?sensor_id=${station.id}&start=${start}&end=${end}`
if(station.id.includes('MUV')) {
rawURL = `https://data.waag.org/api/muv/ms/hourly?sensor_id=${station.id.replace('HLL_MUV_device_','')}&start=${start}&end=${end}`
rawURL = `${endPointDataPlatform}/api/muv/ms/hourly?sensor_id=${station.id.replace('HLL_MUV_device_','')}&start=${start}&end=${end}`
}
const responseRaw = await fetch(rawURL)
......
......@@ -3,8 +3,10 @@ import { roundBy } from "../../data-on-a-map-app/src/util/math"
import { getDataAge } from "../../data-on-a-map-app/src/util/time"
const host = 'https://dataviz.muv2020.eu'
//const host = 'http://localhost:8080'
const endPointDataPlatform = process.env.NODE_ENV === 'development' ? "http://localhost:1886" : "https://data.waag.org"
const endPointLinks = 'https://dataviz.muv2020.eu'
const getPrefix = parameter => {
var prefix = parameter
......@@ -46,10 +48,10 @@ export default {
all: async function(parameter) {
try {
const allResponse = await fetch(`${host}/api/v1/get_stations`)
const allResponse = await fetch(`${endPointLinks}/api/v1/get_stations`)
const all = await allResponse.json()
const latestResponse = await fetch(`${host}/api/v1/get_latest_value?sensor_id=all`)
const latestResponse = await fetch(`${endPointLinks}/api/v1/get_latest_value?sensor_id=all`)
const latest = await latestResponse.json()
let offlineSensors = []
......@@ -152,8 +154,7 @@ export default {
//const data = addMissingDataPoints(conformedData, granularity)
// let's get data from a quicker api for now...
//const response = await fetch(`https://data.waag.org/api/muv/getSensorData?sensor_id=${station.id}&start=${start}&end=${end}`)
const response = await fetch(`https://data.waag.org/api/muv/ms/hourly?sensor_id=${station.id}&start=${start}&end=${end}`)
const response = await fetch(`${endPointDataPlatform}/api/muv/ms/hourly?sensor_id=${station.id}&start=${start}&end=${end}`)
const responseData = await response.json()
let prefix = parameter
......
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