Zugangslinks können gelöscht werden

DELETE-Endpoint im Backend, API-Client-Methode und Löschen-Button
mit Bestätigungsdialog in der Anbieter-Admin-Oberfläche ergänzt.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-31 17:07:42 +02:00
parent e79826d37c
commit 8267b32c39
3 changed files with 29 additions and 2 deletions

View File

@@ -160,6 +160,8 @@ export const api = {
request<AccessLink>(`/admin/provider/access-links?token=${token}`, {
method: 'POST',
body: JSON.stringify({ role, companyId, description })
})
}),
deleteAccessLink: (token: string, id: number) =>
request<void>(`/admin/provider/access-links/${id}?token=${token}`, { method: 'DELETE' })
}
};

View File

@@ -38,6 +38,12 @@
setTimeout(() => { copiedLinkId = null; }, 2000);
}
async function deleteAccessLink(id: number) {
if (!confirm('Diesen Zugangslink wirklich löschen?')) return;
await api.providerAdmin.deleteAccessLink(token, id);
accessLinks = await api.providerAdmin.getAccessLinks(token);
}
// Link Modal
let showLinkModal = false;
let formLinkRole = 'COMPANY_ADMIN';
@@ -309,7 +315,7 @@
</div>
<table class="admin-table">
<thead>
<tr><th>Beschreibung</th><th>Rolle</th><th>Firma</th><th>Link</th></tr>
<tr><th>Beschreibung</th><th>Rolle</th><th>Firma</th><th>Link</th><th></th></tr>
</thead>
<tbody>
{#each accessLinks as link}
@@ -337,6 +343,13 @@
<span class="copy-icon">{copiedLinkId === link.id ? '✓' : '⎘'}</span>
</button>
</td>
<td>
<button
class="btn btn-secondary"
style="padding: 6px 12px; font-size: 0.85rem; color: #ff6b6b; border-color: #ff6b6b;"
on:click={() => deleteAccessLink(link.id)}
>Löschen</button>
</td>
</tr>
{/each}
</tbody>