<script>
import { useForm } from "@inertiajs/svelte";
// props: `token`. Opening the link only shows this page; pressing the button consumes the invitation.
let { token } = $props();
const form = useForm("post", "/invitations/accept", { token });
</script>
<svelte:head><title>Accept invitation</title></svelte:head>
<div class="wrap page">
<div class="card form-card">
<h1>Join the organization</h1>
<p>You were invited to join an organization. The invitation only works while you are signed in with the email address it was sent to.</p>
<form onsubmit={(e) => { e.preventDefault(); $form.post("/invitations/accept"); }}>
<div class="form-actions"><button type="submit" class="btn btn-primary" disabled={$form.processing}>Accept invitation</button></div>
</form>
</div>
</div>