fix reaction counter

This commit is contained in:
@s.roertgen 2025-04-30 09:56:03 +02:00
parent bc23755758
commit 3c84563e1a

View file

@ -16,24 +16,21 @@
tags: [['e', event.id]] tags: [['e', event.id]]
}); });
await reactionEvent.publish(); await reactionEvent.publish();
const r = await $ndk.fetchEvents({kinds: [7], "#e": [event.id]})
console.log("r", r)
$reactions = Array.from(r);
} }
onMount(() => { onMount(async () => {
if (!$user) { if (!$user) {
console.log('no user, logging in'); console.log('no user, logging in');
login(); login();
} }
const r = await $ndk.fetchEvents({kinds: [7], "#e": [event.id]})
console.log("r", r)
$reactions = Array.from(r);
}); });
$effect(() => {
if ($ndkReady) {
const sub = $ndk.subscribe({ kinds: [7], '#e': [event.id] });
sub.on('event', (e) => {
$reactions = [...$reactions, e];
console.log(`${e.content}`);
});
}
});
</script> </script>
<div class="w-full border p-2"> <div class="w-full border p-2">