feat: npm install nextjs-cors weil

Access to fetch at 'http://localhost:3000/api/linesColorApi' from origin 'http://10.10.0.13:3000' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.
This commit is contained in:
ISA
2024-07-16 14:30:17 +02:00
parent f59fa74e12
commit de40d9ccb9
7 changed files with 65 additions and 6 deletions

View File

@@ -1885,7 +1885,11 @@ const MapComponent = ({ locations, onLocationUpdate, lineCoordinates }) => {
})
.then((data) => {
const newLinePositions = data.map((item) => {
console.log("item.idLD", item.idLD);
console.log("item.idModul", item.idModul);
if (item.points && Array.isArray(item.points)) {
//console.log("item.points in MapComponent", item.points);
return {
coordinates: item.points.map((point) => [point.x, point.y]),
idModul: item.idModul,
@@ -1915,6 +1919,9 @@ const MapComponent = ({ locations, onLocationUpdate, lineCoordinates }) => {
const response1 = await fetch(webserviceGisLinesStatusUrl);
const data1 = await response1.json();
const response2 = await fetch("/api/talas_v5_DB/gisLines/readGisLines");
/* const response2 = await fetch(
"http://10.10.0.13/talas5/MessagesMap/mapTypC.aspx?m=10&u=484"
); */
const data2 = await response2.json();
const colorsByModule = {};
@@ -2100,7 +2107,7 @@ const MapComponent = ({ locations, onLocationUpdate, lineCoordinates }) => {
this.bindContextMenu({
contextmenuItems: [
{
text: "Marker entfernen",
text: "Stützpunkt entfernen",
callback: () => {
const newCoords = marker.getLatLng();
const newCoordinates = [...lineData.coordinates];
@@ -2128,7 +2135,7 @@ const MapComponent = ({ locations, onLocationUpdate, lineCoordinates }) => {
contextmenu: true,
contextmenuItems: [
{
text: "Marker hier hinzufügen",
text: "Stützpunkt hinzufügen",
callback: (e) => {
if (tempMarker) {
tempMarker.remove(); // Entfernen des Platzhalter-Icons