diff --git a/Web App/web/src/views/Charging.vue b/Web App/web/src/views/Charging.vue index 0f09aa0..90aba4c 100644 --- a/Web App/web/src/views/Charging.vue +++ b/Web App/web/src/views/Charging.vue @@ -232,14 +232,34 @@ function onChargerImported(charger) { loadChargerLive(true); } -async function removeHomeCharger(c) { - if (!confirm(t("charging.home.removeConfirm", { name: c.name }))) return; +// Removing asks first, inline. A window.confirm() would be shorter, but a +// browser that suppresses dialogs — an embedded webview, a blocked-popups +// setting — hands back false, and the button then does nothing at all with +// nothing said about why. The prompt is part of the page instead, the way the +// charger reset above already asks. +const pendingRemoval = ref(""); // charger id awaiting a yes +const removing = ref(""); + +function askRemoveHomeCharger(c) { homeChargersError.value = ""; + pendingRemoval.value = c.id; +} + +function cancelRemoveHomeCharger() { + pendingRemoval.value = ""; +} + +async function removeHomeCharger(c) { + homeChargersError.value = ""; + removing.value = c.id; try { await api.deleteHomeCharger(c.id); homeChargers.value = homeChargers.value.filter((x) => x.id !== c.id); + pendingRemoval.value = ""; } catch (e) { homeChargersError.value = e.message; + } finally { + removing.value = ""; } } @@ -654,9 +674,8 @@ onMounted(async () => { +
+ {{ t("charging.home.removeConfirm", { name: c.name }) }} +
+{{ t("charging.home.empty") }}