import { Outlet } from 'react-router-dom';
import { useNavigate } from '@/shared/lib/hooks';
import { PullToRefresh } from '@/widgets/pull-to-refresh/pull-to-refresh';
import { useSubLayoutContext } from '@/widgets/sub-layout/use-sub-layout';

export const PullToRefreshRoute = () => {
  const { reload } = useNavigate();
  const subLayoutContext = useSubLayoutContext();

  return (
    <PullToRefresh onRefresh={reload}>
      <Outlet context={{ ...subLayoutContext }} />
    </PullToRefresh>
  );
};
