mirror of
https://github.com/versia-pub/frontend.git
synced 2025-12-06 16:38:20 +01:00
20 lines
549 B
TypeScript
20 lines
549 B
TypeScript
import type { Client } from "@versia/client";
|
|
import type { Account } from "@versia/client/types";
|
|
|
|
export const useAccountFromAcct = (
|
|
client: MaybeRef<Client | null>,
|
|
acct: string,
|
|
): { account: Ref<Account | null>; isLoading: Ref<boolean> } => {
|
|
const output = ref(null as Account | null);
|
|
const isLoading = ref(true);
|
|
|
|
ref(client)
|
|
.value?.lookupAccount(acct)
|
|
.then((res) => {
|
|
isLoading.value = false;
|
|
output.value = res.data;
|
|
});
|
|
|
|
return { account: output, isLoading };
|
|
};
|