2025-05-26 11:19:15 +02:00
|
|
|
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,
|
2025-05-26 11:19:15 +02:00
|
|
|
): {
|
|
|
|
|
account: Ref<z.infer<typeof Account> | null>;
|
|
|
|
|
isLoading: Ref<boolean>;
|
|
|
|
|
} => {
|
|
|
|
|
const output = ref(null as z.infer<typeof Account> | null);
|
2024-12-02 17:20:27 +01:00
|
|
|
const isLoading = ref(true);
|
2025-08-28 07:41:51 +02:00
|
|
|
const authStore = useAuthStore();
|
2024-12-02 16:07:52 +01:00
|
|
|
|
2025-08-28 07:41:51 +02:00
|
|
|
authStore.client.lookupAccount(acct).then((res) => {
|
|
|
|
|
isLoading.value = false;
|
|
|
|
|
output.value = res.data;
|
|
|
|
|
});
|
2024-12-02 16:07:52 +01:00
|
|
|
|
2024-12-02 17:20:27 +01:00
|
|
|
return { account: output, isLoading };
|
2024-12-02 16:07:52 +01:00
|
|
|
};
|