import { useQuery, useMutation, useQueryClient } from '@tanstack/react-query'; import { queryKeys } from '@/lib/query-keys'; import { profileApi } from '@/infrastructure/http/api/profile'; import type { ProfileFormData } from '@/infrastructure/http/api/profile'; export function useProfile() { return useQuery({ queryKey: queryKeys.profile.current(), queryFn: () => profileApi.getProfile(), }); } export function useUpdateProfile() { const queryClient = useQueryClient(); return useMutation({ mutationFn: (data: ProfileFormData) => profileApi.updateProfile(data), onSuccess: () => { queryClient.invalidateQueries({ queryKey: queryKeys.profile.all }); }, }); } export function useChangePassword() { return useMutation({ mutationFn: (data: { currentPassword: string; newPassword: string }) => profileApi.changePassword(data), }); } export function useResendVerification() { return useMutation({ mutationFn: () => profileApi.resendVerification(), }); }