This commit is contained in:
2026-08-29 18:58:13 +02:00
parent 9551e90678
commit f2197a6b28
7 changed files with 214 additions and 73 deletions
+17
View File
@@ -168,3 +168,20 @@ onGatewayEvent("Category", (payload) => {
void useServerStore().fetchServerTree(category.server_id);
}
});
onGatewayEvent("ServerTree", (payload) => {
if (payload.action !== "refresh") return;
const serverId = String(payload.content);
if (serverId) void useServerStore().fetchServerTree(serverId);
});
onGatewayEvent("Server", (payload) => {
if (payload.action !== "update") return;
const updated = payload.content as Server;
const store = useServerStore();
const index = store.servers.findIndex(server => server.id === updated.id);
if (index >= 0) {
updated.unread_count ??= store.servers[index].unread_count ?? 0;
store.servers[index] = updated;
}
});