2024-04-22 09:38:51 +02:00
|
|
|
import type { Mastodon } from "megalodon";
|
2024-04-27 03:28:12 +02:00
|
|
|
import type { Account } from "~/types/mastodon/account";
|
2024-04-22 09:38:51 +02:00
|
|
|
|
2024-04-27 03:28:12 +02:00
|
|
|
export const useAccount = (client: Mastodon | null, accountId: string) => {
|
2024-04-26 07:54:02 +02:00
|
|
|
if (!client) {
|
2024-04-27 03:28:12 +02:00
|
|
|
return ref(null as Account | null);
|
2024-04-22 09:38:51 +02:00
|
|
|
}
|
|
|
|
|
|
2024-04-27 03:28:12 +02:00
|
|
|
const output = ref(null as Account | null);
|
|
|
|
|
|
|
|
|
|
client.getAccount(accountId).then((res) => {
|
|
|
|
|
output.value = res.data;
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
return output;
|
2024-04-22 09:38:51 +02:00
|
|
|
};
|