Pass coordinates back
This commit is contained in:
@@ -55,7 +55,9 @@ app.get('/api/data', async (req, res) => {
|
||||
const celestial = getCelestialCurrent(coords.lat, coords.lon)
|
||||
|
||||
const data = {
|
||||
...coords,
|
||||
gps_lat: coords.lat,
|
||||
gps_lon: coords.lon,
|
||||
gps_alt: coords.alt,
|
||||
...(sensor.status === 'fulfilled' ? sensor.value : {}),
|
||||
...celestial,
|
||||
...(space.status === 'fulfilled' ? space.value : {}),
|
||||
@@ -86,7 +88,7 @@ app.get('/api/hourly', async (req, res) => {
|
||||
|
||||
// Spread space weather into every hourly row
|
||||
const result = mergeRows([sensorRows, meteoHourly, celestial])
|
||||
.map(row => ({ ...coords, ...spaceData, ...row }))
|
||||
.map(row => ({ gps_lat: coords.lat, gps_lon: coords.lon, gps_alt: coords.alt, ...spaceData, ...row }))
|
||||
|
||||
res.json(filterArr(result, fields))
|
||||
})
|
||||
@@ -112,7 +114,7 @@ app.get('/api/daily', async (req, res) => {
|
||||
const celestial = getCelestialDaily(coords.lat, coords.lon, seedRows)
|
||||
|
||||
const result = mergeRows([sensorRows, meteoDaily, celestial])
|
||||
.map(row => ({ ...coords, ...spaceData, ...row }))
|
||||
.map(row => ({ location: coords,gps_lat: coords.lat, gps_lon: coords.lon, gps_alt: coords.alt, ...spaceData, ...row }))
|
||||
|
||||
res.json(filterArr(result, fields))
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user