// /services/database/area/updateAreaService.js

export const updateAreaService = async ({ idLocation, idMap, newCoords }) => {
  const response = await fetch("/api/talas_v5_DB/area/updateArea", {
    method: "PUT",
    headers: {
      "Content-Type": "application/json",
    },
    body: JSON.stringify({
      idLocation,
      idMap,
      x: newCoords.x,
      y: newCoords.y,
    }),
  });

  if (!response.ok) {
    const error = await response.json();
    throw new Error(error.message || "Fehler beim Aktualisieren der Fläche");
  }

  return await response.json();
};
