fix: Meer fixes

This commit is contained in:
2024-07-02 22:33:44 +02:00
parent 0f08868120
commit 045f8f1d22
21 changed files with 27 additions and 45 deletions

View File

View File

View File

@@ -1,36 +0,0 @@
{
"runtimeTarget": {
"name": ".NETCoreApp,Version=v8.0",
"signature": ""
},
"compilationOptions": {},
"targets": {
".NETCoreApp,Version=v8.0": {
"LibServer/1.0.0": {
"dependencies": {
"LibHttp": "1.0.0"
},
"runtime": {
"LibServer.dll": {}
}
},
"LibHttp/1.0.0": {
"runtime": {
"LibHttp.dll": {}
}
}
}
},
"libraries": {
"LibServer/1.0.0": {
"type": "project",
"serviceable": false,
"sha512": ""
},
"LibHttp/1.0.0": {
"type": "project",
"serviceable": false,
"sha512": ""
}
}
}

View File

@@ -2,8 +2,6 @@ using Cassandra;
using LibParse.Json;
using LibServer.Http;
using LibServer.Router;
using Newtonsoft.Json;
using RobotControlServer.JsonClasses;
using System.Drawing;
namespace RobotControlServer.Routes;
@@ -17,8 +15,7 @@ public class RoutePlan(ISession cassandraSession): IRoute {
try {
// Parse request body to Data object, give error if non-nullable fields
// are null.
string id;
var parsedBody = request.Body?.FromJson<Data>();
string? id;
if (!request.QueryString.TryGetValue("id", out id)) {
throw new Exception("id is null");
}
@@ -41,8 +38,7 @@ public class RoutePlan(ISession cassandraSession): IRoute {
List<Point> obstacles = new List<Point>();
// Add obstacle cells
foreach (var obj in $"[{map.GetValue<string>("objects")}]".FromJson<int[][]>()) // $"[{parsedBody?.objects}]".FromJson<int[][]>()
{
foreach (var obj in $"[{map.GetValue<string>("objects")}]".FromJson<int[][]>()) {
obstacles.Add(new Point(obj[0], obj[1])); // Get x and y for every coordinate in the parsedbody array
}

View File

@@ -82,7 +82,8 @@ export default class MapCanvas extends React.Component {
return;
}
if (route || route.points.length > 0) {
console.log(route);
if (route && route.points.length > 0) {
ctx.fillStyle = "#800000";
route.points.forEach(point => {
ctx.beginPath();
@@ -104,8 +105,7 @@ export default class MapCanvas extends React.Component {
async HandlePlan() {
if (this.state.currentMap.length < 1) return;
const url = `${API_ENDPOINT}/database/path/plan?id=${this.state.currentMapId}`;
const data = await (await fetch(url)).json();
console.log(data);
await await fetch(url);
}
render() {