Browse Source

Bug fixing refresh url on Results page

master
Nikola Ignjatovic 4 years ago
parent
commit
7774b91b3c

+ 2
- 1
src/components/ScrapeRequest/ScrapeRequest.js View File

@@ -12,8 +12,9 @@ const ScrapeRequest = ({ scrape, index, handleExecute }) => {
<tr>
<td>
<p>
{console.log(scrape)}
</p><h3><Link to={{
pathname: SCRAPE_RESULTS_PAGE,
pathname: SCRAPE_RESULTS_PAGE.replace(':id', scrape._id),
id: scrape._id
}}>#{index} {scrape.location}</Link></h3>
<span className="text-muted">Count {scrape.count} +</span>

+ 1
- 1
src/constants/pages.js View File

@@ -4,4 +4,4 @@ export const FORGOT_PASSWORD_PAGE = '/forgot-password';
export const HOME_PAGE = '/home';
export const ERROR_PAGE = '/error-page';
export const NOT_FOUND_PAGE = '/not-found';
export const SCRAPE_RESULTS_PAGE = '/scrape-results';
export const SCRAPE_RESULTS_PAGE = '/scrape-results/:id';

+ 9
- 8
src/pages/ScrapeResults/ScrapeResultsPage.js View File

@@ -1,18 +1,19 @@
import React, { useEffect, useState } from 'react';
import { getByIdScrappe } from '../../request/scrappe';
import { Link } from "react-router-dom";
import { Link , useParams } from "react-router-dom";

import ScrappeDetails from '../../components/ScrappeDetails/ScrappeDetails'
import ScrappeResult from '../../components/ScrappeResult/ScrappeResult'
import PropTypes from 'prop-types';
//import PropTypes from 'prop-types';

const ScrapeResultsPage = ({ location }) => {
const ScrapeResultsPage = () => {

let { id } = useParams()
const [scrappeResults, setScrappeResults] = useState()
const [scrappeDetails, setScrappeDetails] = useState()
useEffect(() => {
getByIdScrappe(location.id)
getByIdScrappe(id)
.then(res => {
setScrappeDetails(res.data)
@@ -24,7 +25,7 @@ const ScrapeResultsPage = ({ location }) => {
return (
<>
{console.log(id)}
<nav className="main-header navbar navbar-expand-md navbar-light navbar-white">
<div className="container">
@@ -48,8 +49,8 @@ const ScrapeResultsPage = ({ location }) => {
);
};

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

export default ScrapeResultsPage;

Loading…
Cancel
Save