summaryrefslogtreecommitdiff
path: root/hi-ui/src/lib/MessageInput.svelte
diff options
context:
space:
mode:
authorKit La Touche <kit@transneptune.net>2024-09-30 23:14:36 -0400
committerKit La Touche <kit@transneptune.net>2024-09-30 23:14:36 -0400
commit01d995c731c296292cd3f1f9a4702eb96a0bf628 (patch)
treea0bbe131a22afcf1b727a1769cfffe38cada0558 /hi-ui/src/lib/MessageInput.svelte
parentc0fead957c6433be1ddfbbe8a55276a4aa8fc4df (diff)
Absorb and display events
At least message-type ones, and at least without styling or memory-limit concerns.
Diffstat (limited to 'hi-ui/src/lib/MessageInput.svelte')
-rw-r--r--hi-ui/src/lib/MessageInput.svelte17
1 files changed, 15 insertions, 2 deletions
diff --git a/hi-ui/src/lib/MessageInput.svelte b/hi-ui/src/lib/MessageInput.svelte
index 4bb4aab..96e9577 100644
--- a/hi-ui/src/lib/MessageInput.svelte
+++ b/hi-ui/src/lib/MessageInput.svelte
@@ -1,9 +1,22 @@
<script>
+ import { postToChannel } from '../apiServer';
+ import { activeChannel } from '../store';
+
let input;
let disabled = false;
+ let activeChannelId;
+
+ activeChannel.subscribe((value) => {
+ activeChannelId = value ? value.id : null;
+ });
- function handleSubmit(event) {
- console.log(event);
+ async function handleSubmit(event) {
+ event.preventDefault();
+ disabled = true;
+ // TODO try/catch:
+ await postToChannel(activeChannelId, input);
+ input = '';
+ disabled = false;
}
</script>