Remove constants from state in wizard steps controller
[MAILPOET-1916]
This commit is contained in:
committed by
M. Shull
parent
1edfedbe01
commit
8edf58b2b2
@@ -9,18 +9,19 @@ import WelcomeWizardUsageTrackingStep from './steps/usage_tracking_step.jsx';
|
|||||||
import WelcomeWizardWooCommerceStep from './steps/woo_commerce_step.jsx';
|
import WelcomeWizardWooCommerceStep from './steps/woo_commerce_step.jsx';
|
||||||
|
|
||||||
const WelcomeWizardStepsController = (props) => {
|
const WelcomeWizardStepsController = (props) => {
|
||||||
const [stepsCount] = useState(window.is_woocommerce_active ? 4 : 3);
|
const stepsCount = window.is_woocommerce_active ? 4 : 3;
|
||||||
const [shouldSetSender] = useState(!window.is_mp2_migration_complete);
|
const shouldSetSender = !window.is_mp2_migration_complete;
|
||||||
|
const step = parseInt(props.match.params.step, 10);
|
||||||
|
|
||||||
const [loading, setLoading] = useState(false);
|
const [loading, setLoading] = useState(false);
|
||||||
const [sender, setSender] = useState(window.sender_data);
|
const [sender, setSender] = useState(window.sender_data);
|
||||||
const [replyTo, setReplyTo] = useState(window.reply_to_data);
|
const [replyTo, setReplyTo] = useState(window.reply_to_data);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const step = parseInt(props.match.params.step, 10);
|
|
||||||
if (step > stepsCount || step < 1) {
|
if (step > stepsCount || step < 1) {
|
||||||
props.history.push('/steps/1');
|
props.history.push('/steps/1');
|
||||||
}
|
}
|
||||||
});
|
}, [step, stepsCount, props.history]);
|
||||||
|
|
||||||
function finishWizard() {
|
function finishWizard() {
|
||||||
setLoading(true);
|
setLoading(true);
|
||||||
@@ -73,8 +74,6 @@ const WelcomeWizardStepsController = (props) => {
|
|||||||
}).then(() => (props.history.push('/steps/2')));
|
}).then(() => (props.history.push('/steps/2')));
|
||||||
}
|
}
|
||||||
|
|
||||||
const step = parseInt(props.match.params.step, 10);
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="mailpoet_welcome_wizard_steps mailpoet_welcome_wizard_centered_column">
|
<div className="mailpoet_welcome_wizard_steps mailpoet_welcome_wizard_centered_column">
|
||||||
<WelcomeWizardHeader
|
<WelcomeWizardHeader
|
||||||
|
Reference in New Issue
Block a user