|
|
|
|
@ -2,16 +2,17 @@ const config = require("./config.json");
|
|
|
|
|
import CapturedArea from "./components/captured-area";
|
|
|
|
|
|
|
|
|
|
export const sendArea = (gameID, username, polygon) => {
|
|
|
|
|
console.log(polygon)
|
|
|
|
|
// console.log(polygon)
|
|
|
|
|
points = []
|
|
|
|
|
polygon.map((point) => {
|
|
|
|
|
points.push({lat: point.coordinate.latitude, lon: point.coordinate.longitude})
|
|
|
|
|
points.push({lat: point.coordinate.latitude, lng: point.coordinate.longitude})
|
|
|
|
|
})
|
|
|
|
|
let formBody = [];
|
|
|
|
|
formBody.push("gameID=" + gameID);
|
|
|
|
|
formBody.push("userID=" + username);
|
|
|
|
|
formBody.push("points=" + JSON.stringify(points));
|
|
|
|
|
formBody = formBody.join("&");
|
|
|
|
|
console.log(formBody)
|
|
|
|
|
fetch("http://"+config.host + ":" + config.port + "/v1/polygon", {
|
|
|
|
|
method: "post",
|
|
|
|
|
headers: {'Content-Type':'application/x-www-form-urlencoded;charset=UTF-8'},
|
|
|
|
|
|