summaryrefslogtreecommitdiff
path: root/hi-ui/src/routes
diff options
context:
space:
mode:
authorOwen Jacobson <owen@grimoire.ca>2024-10-09 01:43:34 -0400
committerOwen Jacobson <owen@grimoire.ca>2024-10-09 11:45:31 -0400
commit2f0b77e8fd02a137047c8975a573626cd76310ff (patch)
tree481d82e99cf8aad8fe256d8186ae72bcee23bf9f /hi-ui/src/routes
parentba96974bdebd6d4ec345907d49944b5ee644ed47 (diff)
Return a flat message list on boot, not nested lists by channel.
This is a bit easier to compute, and sets us up nicely for pulling message boot out of the `/api/boot` response entirely.
Diffstat (limited to 'hi-ui/src/routes')
-rw-r--r--hi-ui/src/routes/+page.svelte14
1 files changed, 4 insertions, 10 deletions
diff --git a/hi-ui/src/routes/+page.svelte b/hi-ui/src/routes/+page.svelte
index 39f8b62..dd5f2f7 100644
--- a/hi-ui/src/routes/+page.svelte
+++ b/hi-ui/src/routes/+page.svelte
@@ -18,20 +18,13 @@
});
function onBooted(boot) {
- logins.update((value) => value.addLogins(boot.logins));
currentUser.update(() => ({
id: boot.login.id,
username: boot.login.name,
}));
- let channels = boot.channels.map((channel) => ({
- id: channel.id,
- name: channel.name,
- }));
- channelsList.update((value) => value.setChannels(channels));
- let bootMessages = boot.channels.map((channel) => [channel.id, channel.messages]);
- for (let [channel, channelMessages] of bootMessages) {
- messages.update((value) => value.addMessages(channel, channelMessages));
- }
+ logins.update((value) => value.setLogins(boot.logins));
+ channelsList.update((value) => value.setChannels(boot.channels));
+ messages.update((value) => value.setMessages(boot.messages));
}
onMount(async () => {
@@ -39,6 +32,7 @@
let response = await boot();
switch (response.status) {
case 200:
+ debugger;
onBooted(response.data);
subscribeToEvents(response.data.resume_point);
break;