feat: show all reacted users initially in reactions tab
This commit is contained in:
parent
36a4f30377
commit
ddbe213f59
@ -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>
|
||||
|
Loading…
Reference in New Issue
Block a user