blob: afa3f783d2c0f69c0a7c9ef63c077610b0b76433 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
<script>
import { createChannel } from '$lib/apiServer';
let name = $state('');
let pending = false;
let disabled = $derived(pending);
async function handleSubmit(event) {
event.preventDefault();
pending = true;
const response = await createChannel(name);
if (200 <= response.status && response.status < 300) {
name = '';
}
pending = false;
}
</script>
<form onsubmit={handleSubmit} class="form form-row flex-nowrap">
<input
type="text"
placeholder="create channel"
bind:value={name}
{disabled}
class="input flex-auto h-6 w-9/12"
/>
<button type="submit" class="flex-none w-6 h-6">➕</button>
</form>
<style>
</style>
|