mirror of
https://github.com/Freika/dawarich.git
synced 2026-01-11 01:31:39 -05:00
Fix a bug where the confirmation alert was shown more than once when deleting a point.
This commit is contained in:
parent
f99725e2f3
commit
740d203647
3 changed files with 20 additions and 2 deletions
|
|
@ -1,2 +1,8 @@
|
||||||
/log
|
/log
|
||||||
/tmp
|
/tmp
|
||||||
|
|
||||||
|
# We need directories for import and export files, but not the files themselves.
|
||||||
|
/public/exports/*
|
||||||
|
!/public/exports/.keep
|
||||||
|
/public/imports/*
|
||||||
|
!/public/imports/.keep
|
||||||
|
|
|
||||||
|
|
@ -36,6 +36,10 @@ Example of a valid point in GeoJSON format:
|
||||||
|
|
||||||
- Default exporting format is now GeoJSON instead of Owntracks-like JSON. This will allow you to use the exported data in other applications that support GeoJSON format.
|
- Default exporting format is now GeoJSON instead of Owntracks-like JSON. This will allow you to use the exported data in other applications that support GeoJSON format.
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- Fixed a bug where the confirmation alert was shown more than once when deleting a point.
|
||||||
|
|
||||||
|
|
||||||
## [0.12.3] — 2024-09-02
|
## [0.12.3] — 2024-09-02
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -145,8 +145,12 @@ export default class extends Controller {
|
||||||
`;
|
`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
removeEventListeners() {
|
||||||
|
document.removeEventListener('click', this.handleDeleteClick);
|
||||||
|
}
|
||||||
|
|
||||||
addEventListeners() {
|
addEventListeners() {
|
||||||
document.addEventListener('click', (event) => {
|
this.handleDeleteClick = (event) => {
|
||||||
if (event.target && event.target.classList.contains('delete-point')) {
|
if (event.target && event.target.classList.contains('delete-point')) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
const pointId = event.target.getAttribute('data-id');
|
const pointId = event.target.getAttribute('data-id');
|
||||||
|
|
@ -155,7 +159,11 @@ export default class extends Controller {
|
||||||
this.deletePoint(pointId, this.apiKey);
|
this.deletePoint(pointId, this.apiKey);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
};
|
||||||
|
|
||||||
|
// Ensure only one listener is attached by removing any existing ones first
|
||||||
|
this.removeEventListeners();
|
||||||
|
document.addEventListener('click', this.handleDeleteClick);
|
||||||
}
|
}
|
||||||
|
|
||||||
deletePoint(id, apiKey) {
|
deletePoint(id, apiKey) {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue