Drop @mui, addded ems api
This commit is contained in:
23
client/src/actions/map.ts
Normal file
23
client/src/actions/map.ts
Normal file
@ -0,0 +1,23 @@
|
||||
import { Coordinate } from "ol/coordinate";
|
||||
import { IGeometryType } from "../interfaces/map";
|
||||
|
||||
export const uploadCoordinates = async (coordinates: Coordinate[], type: IGeometryType) => {
|
||||
try {
|
||||
const response = await fetch(`${import.meta.env.VITE_API_EMS_URL}/nodes`, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
body: JSON.stringify({ coordinates, object_id: 1, type: type }) // Replace with actual object_id
|
||||
});
|
||||
|
||||
if (response.ok) {
|
||||
const data = await response.json();
|
||||
console.log('Node created:', data);
|
||||
} else {
|
||||
console.error('Failed to upload coordinates');
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('Error:', error);
|
||||
}
|
||||
};
|
Reference in New Issue
Block a user