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 was merged in pull request #58.
This commit is contained in:
2026-04-10 20:31:19 +02:00
committed by marcel
parent 69d695b2c4
commit b577b7a0f8

View File

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