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