import { useNewNavigate } from '@/modules';
import { ParseData } from '../store';
export const useToCodeEditor = () => {
  const navigate = useNewNavigate();
  const toPage = (pathKey: ParseData['updatePath'], data: ParseData['data']) => {
    navigate('/code-editor', {
      state: {
        updatePath: pathKey,
        data,
      },
    });
  };
  const PageUpdate = {
    path: 'page',
    key: 'update',
  };
  const toPagePage = (data: ParseData['data']) => {
    navigate('/code-editor', {
      state: {
        updatePath: PageUpdate,
        data,
      },
    });
  };
  return {
    toPage,
    toPagePage,
  };
};
