22 lines
764 B
JavaScript
22 lines
764 B
JavaScript
export async function processForm (e) {
|
|
e.preventDefault();
|
|
// const [name, description, image] = e.target[0,1,2]
|
|
const remainingForm = document.getElementById("remainingForm")
|
|
remainingForm.style.display = 'none';
|
|
|
|
const markerForm = document.getElementById("markerForm")
|
|
const formData = new FormData(markerForm)
|
|
document.getElementById("markerFormContainer").style.display = 'none';
|
|
markerForm.reset();
|
|
// const tmpMarker = localStorage.getItem("tmpMarkerId");
|
|
// L.layerGroup().removeLayer(tmpMarker);
|
|
await fetch('/uploadMarker', {
|
|
method: 'POST',
|
|
body: formData,
|
|
}).then( async () => {
|
|
const map = require('./map');
|
|
await map.fetchNewMarkers();
|
|
}
|
|
)
|
|
};
|
|
|