Feature: Konto löschen (Play Store Pflicht) — DELETE /profile/account + Button in Settings (SW by-v786)
This commit is contained in:
parent
e8cf742911
commit
e4b170d45b
6 changed files with 59 additions and 7 deletions
|
|
@ -287,6 +287,15 @@ window.Page_settings = (() => {
|
|||
<svg class="ph-icon" aria-hidden="true"><use href="/icons/phosphor.svg#sign-out"></use></svg>
|
||||
Abmelden
|
||||
</button>
|
||||
<button id="settings-delete-account-btn"
|
||||
style="width:100%;margin-top:var(--space-2);display:flex;align-items:center;justify-content:center;
|
||||
gap:var(--space-2);padding:var(--space-2) var(--space-4);
|
||||
border-radius:var(--radius-md);border:none;
|
||||
background:none;color:var(--c-text-muted);
|
||||
font-size:var(--text-xs);cursor:pointer">
|
||||
<svg class="ph-icon" aria-hidden="true" style="width:12px;height:12px"><use href="/icons/phosphor.svg#trash"></use></svg>
|
||||
Konto löschen
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -789,6 +798,24 @@ window.Page_settings = (() => {
|
|||
_render();
|
||||
});
|
||||
|
||||
document.getElementById('settings-delete-account-btn')?.addEventListener('click', async () => {
|
||||
const ok = await UI.modal.confirm({
|
||||
title: 'Konto unwiderruflich löschen?',
|
||||
body: 'Alle deine Daten (Tagebuch, Gesundheit, Training, Fotos) werden dauerhaft gelöscht. Diese Aktion kann nicht rückgängig gemacht werden.',
|
||||
confirmText: 'Ja, Konto löschen',
|
||||
danger: true,
|
||||
});
|
||||
if (!ok) return;
|
||||
try {
|
||||
await API.del('/profile/account');
|
||||
_appState.user = null; _appState.dogs = []; _appState.activeDog = null;
|
||||
UI.toast.info('Dein Konto wurde gelöscht.');
|
||||
App.navigate('welcome');
|
||||
} catch {
|
||||
UI.toast.error('Konto konnte nicht gelöscht werden. Bitte versuche es erneut.');
|
||||
}
|
||||
});
|
||||
|
||||
document.getElementById('settings-install-btn')?.addEventListener('click', () => {
|
||||
App.navigate('welcome', true, { install: true });
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue