frontend/composables/Account.ts
2024-04-26 18:50:30 -10:00

22 lines
468 B
TypeScript

import type { Mastodon } from "megalodon";
import type { Account } from "~/types/mastodon/account";
export const useAccount = (
client: MaybeRef<Mastodon | null>,
accountId: string,
) => {
if (!client) {
return ref(null as Account | null);
}
const output = ref(null as Account | null);
ref(client)
.value?.getAccount(accountId)
.then((res) => {
output.value = res.data;
});
return output;
};