Autoría | Ultima modificación | Ver Log |
import { useFetch, useApi, useAlert } from '@shared/hooks';import { updateLocationSettings } from '@account-settings/services';export function useLocationSettings() {const { showSuccess, showError } = useAlert();const {data: locationData,loading: isLoading,refetch} = useFetch('/account-settings/location');const { loading: isUpdating, execute: executeUpdate } = useApi(updateLocationSettings, {onSuccess: (response) => {if (response.success) {showSuccess(response.data);refetch();} else {showError(response.data || 'Error al actualizar la ubicación');}},onError: (error) => {showError(error.message || 'Error al actualizar la ubicación');}});const updateLocation = async (data) => {await executeUpdate(data);};return {locationData,isLoading,isUpdating,updateLocation};}