summaryrefslogtreecommitdiff
path: root/ui/lib/components/Invites.svelte
blob: cc14f3bd05ff3f814b6518438c98adbc14b87a87 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
<script>
  import { createInvite } from '$lib/apiServer';
  import Invite from '$lib/components/Invite.svelte';

  let invites = $state([]);

  async function onSubmit(event) {
    event.preventDefault();
    let response = await createInvite();
    if (response.status == 200) {
      invites.push(response.data);
    }
  }
</script>

<ul>
  {#each invites as invite}
    <li><Invite id={invite.id} /></li>
  {/each}
</ul>
<form onsubmit={onSubmit}>
  <button class="btn variant-filled" type="submit"> Create Invitation </button>
</form>