export function useScrollTo () { const router = useRouter(); function scroll (id: string) { const element = document.getElementById(id); if (element) { element.scrollIntoView({ behavior: 'smooth' }); } else { console.error('Element not found:', id); } } function scrollTo ( id: string, routePath?: string ) { if (routePath) { router.push({ path: routePath }).then(() => { scroll(id); }); } else { setTimeout(() => { scroll(id); }, 100); } } return { scrollTo }; }