refactor: ♻️ Rewrite state system to use Pinia for composer and auth

This commit is contained in:
Jesse Wierzbinski 2025-08-28 07:41:51 +02:00
parent a6db9e059d
commit b510782a30
No known key found for this signature in database
80 changed files with 999 additions and 1011 deletions

View file

@ -1,9 +1,7 @@
import type { Client } from "@versia/client";
import type { Account } from "@versia/client/schemas";
import type { z } from "zod";
export const useAccountFromAcct = (
client: MaybeRef<Client | null>,
acct: string,
): {
account: Ref<z.infer<typeof Account> | null>;
@ -11,13 +9,12 @@ export const useAccountFromAcct = (
} => {
const output = ref(null as z.infer<typeof Account> | null);
const isLoading = ref(true);
const authStore = useAuthStore();
ref(client)
.value?.lookupAccount(acct)
.then((res) => {
isLoading.value = false;
output.value = res.data;
});
authStore.client.lookupAccount(acct).then((res) => {
isLoading.value = false;
output.value = res.data;
});
return { account: output, isLoading };
};