🐛 Close the add pin modal after the sucess

home
Alexis Feron 3 months ago
parent b234894173
commit 235f1c6c64

@ -27,6 +27,7 @@
</h3>
<button
type="button"
id="close-modal"
class="end-2.5 text-gray-400 bg-transparent hover:bg-gray-200 hover:text-gray-900 rounded-lg text-sm w-8 h-8 ms-auto inline-flex justify-center items-center dark:hover:bg-gray-600 dark:hover:text-white"
data-modal-hide="authentication-modal"
>

@ -96,14 +96,21 @@ export class AddPinPopupComponent implements OnInit {
const pinData = {
...this.form.value,
files: this.files, // Ajoutez les fichiers au payload
files: this.files,
};
console.log('Form submitted with data:', pinData);
this.addPinService.addPin(pinData);
this.addPinService.addPin(pinData).add(() => {
this.closeModal();
});
} else {
console.error('Le formulaire est invalide');
}
}
private closeModal() {
const modal = document.getElementById('close-modal');
if (modal) {
modal.click();
}
}
}

Loading…
Cancel
Save