fix(members): add error toasts for invite failures + Content-Type header

- handleInviteClick: show toast and bail early when POST /invites fails
- handleRegenerate: show toast when regeneration POST fails
- handleRoleChange: add Content-Type: application/json header on PATCH

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-04-10 20:31:19 +02:00
parent 9d3be84a0c
commit 60d84c0c94

View File

@@ -31,6 +31,7 @@
const res = await fetch('/members/' + member.userId, {
method: 'PATCH',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ role: newRole })
});
@@ -64,6 +65,9 @@
const res = await fetch('/members/invites', { method: 'POST' });
if (res.ok) {
activeInvite = await res.json();
} else {
showToast('Einladung konnte nicht erstellt werden');
return;
}
}
showInvitePanel = !showInvitePanel;
@@ -73,6 +77,8 @@
const res = await fetch('/members/invites', { method: 'POST' });
if (res.ok) {
activeInvite = await res.json();
} else {
showToast('Link konnte nicht erneuert werden');
}
}
</script>