mirror of
https://github.com/versia-pub/frontend.git
synced 2026-03-13 03:29:16 +01:00
feat: ✨ Add new virtual scrollbar system, resolve note context
This commit is contained in:
parent
dd62647928
commit
6f0da44844
14 changed files with 94 additions and 17 deletions
|
|
@ -11,7 +11,7 @@ export const useNote = (client: MaybeRef<Mastodon | null>, noteId: string) => {
|
|||
ref(client)
|
||||
.value?.getStatus(noteId)
|
||||
.then((res) => {
|
||||
output.value = res.data;
|
||||
output.value = res.data as Status;
|
||||
});
|
||||
|
||||
return output;
|
||||
|
|
|
|||
24
composables/NoteContext.ts
Normal file
24
composables/NoteContext.ts
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
import type { Mastodon } from "megalodon";
|
||||
import type { Context } from "~/types/mastodon/context";
|
||||
|
||||
export const useNoteContext = (
|
||||
client: MaybeRef<Mastodon | null>,
|
||||
noteId: MaybeRef<string | null>,
|
||||
) => {
|
||||
if (!ref(client).value) {
|
||||
return ref(null as Context | null);
|
||||
}
|
||||
|
||||
const output = ref(null as Context | null);
|
||||
|
||||
watchEffect(() => {
|
||||
if (toValue(noteId))
|
||||
ref(client)
|
||||
.value?.getStatusContext(toValue(noteId) ?? "")
|
||||
.then((res) => {
|
||||
output.value = res.data as Context;
|
||||
});
|
||||
});
|
||||
|
||||
return output;
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue