import type { Client } from "@versia/client"; import type { Context } from "@versia/client/schemas"; import type { z } from "zod"; export const useNoteContext = ( client: MaybeRef, noteId: MaybeRef, ) => { if (!ref(client).value) { return ref(null as z.infer | null); } const output = ref(null as z.infer | null); watchEffect(() => { if (toValue(noteId)) { ref(client) .value?.getStatusContext(toValue(noteId) ?? "") .then((res) => { output.value = res.data; }); } }); return output; };