import { useEffect, useState } from 'react' import { getOnboardingStatus } from '@/api/onboarding' import type { OnboardingStatus } from '@/api/onboarding' /** * Tiny shared hook that fetches `/users/onboarding-status` once on mount. * * Used by `NextStepCard`, `SetupChecklist`, and `QuickStartPage` so the toggle * row can disappear when there's nothing to show. Each consumer has its own * state — fetches are not deduplicated. That's fine for now; if it becomes a * problem we can lift this into a Zustand store or react-query. */ export function useOnboardingStatus(): OnboardingStatus | null { const [status, setStatus] = useState(null) useEffect(() => { getOnboardingStatus() .then(setStatus) .catch(() => { // Silently fail — never block the dashboard if the endpoint is down. }) }, []) return status } export default useOnboardingStatus