27 lines
990 B
JavaScript
27 lines
990 B
JavaScript
document.getElementById('file-input').addEventListener('change', function() {
|
|
const fileName = this.files[0] ? this.files[0].name : 'No file chosen';
|
|
document.querySelector('.file-chosen').textContent = fileName;
|
|
});
|
|
|
|
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();
|
|
}
|
|
)
|
|
};
|
|
|