From 57ce322aca090f9ff1d33c619c39dbbffe2a96cc Mon Sep 17 00:00:00 2001 From: Umbra Sheep Date: Sun, 30 Sep 2018 20:25:15 +1300 Subject: [PATCH] Fixed polygons not returning as a list --- api/v1/api.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/api/v1/api.js b/api/v1/api.js index 8b5951b..af585ff 100644 --- a/api/v1/api.js +++ b/api/v1/api.js @@ -12,16 +12,18 @@ module.exports = { return res.send(400); } // console.log(rows); - let polygon = {} + let polygons = [] polygon.coords = []; rows[0].map((point) => { + let polygon = {}; polygon.polygonID = point.polygonID; polygon.coords.push({lat: point.lat, lng: point.lng}); polygon.gameID = point.gameID; polygon.userID = point.userID; polygon.colour = point.colour; + polygons.push(polygon); }); - res.send(polygon); + res.send(polygons); return; }); } else {