mirror of
https://github.com/versia-pub/frontend.git
synced 2026-06-14 15:39:15 +02:00
refactor: ♻️ Rewrite state system to use Pinia for composer and auth
This commit is contained in:
parent
a6db9e059d
commit
b510782a30
80 changed files with 999 additions and 1011 deletions
|
|
@ -1,21 +1,19 @@
|
|||
import type { Client } from "@versia/client";
|
||||
import type { Status } from "@versia/client/schemas";
|
||||
import type { z } from "zod";
|
||||
|
||||
export const useNote = (
|
||||
client: MaybeRef<Client | null>,
|
||||
noteId: MaybeRef<string | null>,
|
||||
) => {
|
||||
if (!(toValue(client) && toValue(noteId))) {
|
||||
export const useNote = (noteId: MaybeRef<string | null>) => {
|
||||
if (!toValue(noteId)) {
|
||||
return ref(null as z.infer<typeof Status> | null);
|
||||
}
|
||||
|
||||
const authStore = useAuthStore();
|
||||
|
||||
const output = ref(null as z.infer<typeof Status> | null);
|
||||
|
||||
watchEffect(() => {
|
||||
toValue(noteId) &&
|
||||
toValue(client)
|
||||
?.getStatus(toValue(noteId) as string)
|
||||
authStore.client
|
||||
.getStatus(toValue(noteId) as string)
|
||||
.then((res) => {
|
||||
output.value = res.data;
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue