blob: 471c2b76d123f24ec9ac63c0cb558307f58bf35f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
<script>
let { createChannel = async (name) => {} } = $props();
let name = $state('');
let disabled = $state(false);
async function onsubmit(event) {
event.preventDefault();
disabled = true;
try {
await createChannel(name);
event.target.reset();
} finally {
disabled = false;
}
}
</script>
<form {onsubmit}>
<input type="text" placeholder="create channel" bind:value={name} {disabled} />
<button type="submit">➕</button>
</form>
|