import {onMounted, ref} from "vue"; import {ProfileService} from "@/infrastructure/api/ProfileService"; import {GetProfile} from "@/domain/usecases/GetProfile"; const profileService = new ProfileService(); const getProfileUseCase = new GetProfile(profileService); export function useProfile() { const profile = ref(null); const loading = ref(false); const error = ref(null); onMounted(async () => { loading.value = true; try { profile.value = await getProfileUseCase.execute(); } catch (err: any) { error.value = err.message; } finally { loading.value = false; } }); return {profile, loading}; }