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:
@@ -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>
|
||||||
|
|||||||
Reference in New Issue
Block a user