blob: 9e6e469b88342bf3331c38ccbe88043be18b8031 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
|
<script>
import { copy } from 'svelte-copy';
let { id } = $props();
let inviteUrl = $derived(new URL(`/invite/${id}`, document.location));
// Nota bene: we cannot use:copy={inviteUrl}, because inviteUrl is not a
// string, and therefore will get treated as an options object. So we must
// explicitly build an options object, containing the value that will
// eventually be interpreted as a string.
</script>
<button use:copy={{ text: inviteUrl }}>copy</button>
<span>{inviteUrl}</span>
|