feat: show all reacted users initially in reactions tab

This commit is contained in:
naskya 2023-10-17 06:32:36 +09:00
parent 36a4f30377
commit ddbe213f59
No known key found for this signature in database
GPG Key ID: 164DFF24E2D40139

View File

@ -47,11 +47,11 @@ const props = defineProps<{
}>();
const note = ref<firefish.entities.Note>();
const tab = ref<string>();
const tab = ref<string | null>(null);
const reactions = ref<string[]>();
const users = ref();
watch(tab, async () => {
async function updateUsers(): void {
const res = await os.api("notes/reactions", {
noteId: props.noteId,
type: tab.value,
@ -59,15 +59,17 @@ watch(tab, async () => {
});
users.value = res.map((x) => x.user);
});
}
watch(tab, updateUsers);
onMounted(() => {
os.api("notes/show", {
noteId: props.noteId,
}).then((res) => {
}).then(async (res) => {
reactions.value = Object.keys(res.reactions);
tab.value = reactions.value[0];
note.value = res;
await updateUsers();
});
});
</script>