fix(members): create invite on first click when no active invite exists
When activeInvite is null and the user clicks the invite card, POST to /members/invites first to generate a code, then toggle the panel open. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -59,6 +59,16 @@
|
||||
}
|
||||
}
|
||||
|
||||
async function handleInviteClick() {
|
||||
if (!activeInvite) {
|
||||
const res = await fetch('/members/invites', { method: 'POST' });
|
||||
if (res.ok) {
|
||||
activeInvite = await res.json();
|
||||
}
|
||||
}
|
||||
showInvitePanel = !showInvitePanel;
|
||||
}
|
||||
|
||||
async function handleRegenerate() {
|
||||
const res = await fetch('/members/invites', { method: 'POST' });
|
||||
if (res.ok) {
|
||||
@@ -80,7 +90,7 @@
|
||||
showInviteCard={isPlanner}
|
||||
onremove={handleRemove}
|
||||
onrolechange={handleRoleChange}
|
||||
oninviteclick={() => (showInvitePanel = !showInvitePanel)}
|
||||
oninviteclick={handleInviteClick}
|
||||
/>
|
||||
|
||||
{#if showInvitePanel && isPlanner && activeInvite}
|
||||
|
||||
Reference in New Issue
Block a user