frontend/app/composables/AccountAcct.ts

21 lines
545 B
TypeScript
Raw Normal View History

import type { Account } from "@versia/client/schemas";
import type { z } from "zod";
2024-12-02 16:07:52 +01:00
export const useAccountFromAcct = (
acct: string,
): {
account: Ref<z.infer<typeof Account> | null>;
isLoading: Ref<boolean>;
} => {
const output = ref(null as z.infer<typeof Account> | null);
const isLoading = ref(true);
const authStore = useAuthStore();
2024-12-02 16:07:52 +01:00
authStore.client.lookupAccount(acct).then((res) => {
isLoading.value = false;
output.value = res.data;
});
2024-12-02 16:07:52 +01:00
return { account: output, isLoading };
2024-12-02 16:07:52 +01:00
};