From cf4ffe719d7f9373ab65cf92699b5201c783242d Mon Sep 17 00:00:00 2001 From: Pavel Dohnal Date: Mon, 1 Jul 2019 12:21:23 +0200 Subject: [PATCH] Use react router [MAILPOET-1809] --- .../importExport/import/step_method_selection.jsx | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/assets/js/src/subscribers/importExport/import/step_method_selection.jsx b/assets/js/src/subscribers/importExport/import/step_method_selection.jsx index 5a77b25762..b4b5c07dcf 100644 --- a/assets/js/src/subscribers/importExport/import/step_method_selection.jsx +++ b/assets/js/src/subscribers/importExport/import/step_method_selection.jsx @@ -1,4 +1,5 @@ import React, { useState } from 'react'; +import { withRouter } from 'react-router-dom'; import PropTypes from 'prop-types'; import MailPoet from 'mailpoet'; import SelectMethod from './step_method_selection/select_import_method.jsx'; @@ -23,7 +24,7 @@ const getNextStepLink = (importData) => { }; function StepMethodSelection({ - navigate, + history, }) { const [method, setMethod] = useState(undefined); const [pastedCsvData, setPastedCsvData] = useState(''); @@ -31,10 +32,8 @@ function StepMethodSelection({ const finish = (parsedData) => { window.importData.step_method_selection = parsedData; - navigate( - getNextStepLink(window.importData.step_method_selection), - { trigger: true } - ); + setStepMethodSelection(parsedData); + history.push(getNextStepLink(parsedData)); }; const processLocal = () => { @@ -92,7 +91,9 @@ function StepMethodSelection({ } StepMethodSelection.propTypes = { - navigate: PropTypes.func.isRequired, + history: PropTypes.shape({ + push: PropTypes.func.isRequired, + }).isRequired, }; -export default StepMethodSelection; +export default withRouter(StepMethodSelection);