This commit is contained in:
scossa 2024-08-23 15:15:22 +02:00
parent 02cf5f330d
commit 8d819d40b7

View file

@ -1,29 +0,0 @@
document.getElementById('file-input').addEventListener('change', function() {
const fileName = this.files[0] ? this.files[0].name : 'No file chosen';
const truncatedFileName = fileName.length > 21 ? fileName.slice(0, 21) + '...' : fileName;
document.querySelector('.file-chosen').textContent = truncatedFileName;
});
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';
document.getElementById("addMarkerBtn").innerHTML = '<img src="../img/marker-icon18.png" alt="Button Image" />';
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();
}
)
};