import React, { useEffect, useState } from 'react';
import { getByIdScrappe } from '../../request/scrappe';
import PropTypes from 'prop-types';

const ScrapeResultsPage = ({ location }) => {

  const [scrappeResults, setScrappeResults] = useState()
  useEffect(() => {
    getByIdScrappe(location.id).then(res => res.data.status === 'done' ? setScrappeResults(res.data.result) : setScrappeResults(res.data))
  }, [setScrappeResults])
  console.log("scrappeResults", scrappeResults)
  return (
    <div className="c-error-page">
      <div className="c-error-page__content">
        {scrappeResults.count}
      </div>
    </div>
  );
};

ScrapeResultsPage.propTypes = {
  location: PropTypes.object
};

export default ScrapeResultsPage;
