Make the code simpler

[MAILPOET-2142]
This commit is contained in:
Pavel Dohnal
2019-09-12 11:28:02 +02:00
committed by Jack Kitterhing
parent e9918fa236
commit 3521423b52

View File

@@ -8,24 +8,10 @@ export const getStepsCount = () => {
};
export const redirectToNextStep = (history, finishWizard, currentStep) => {
if (currentStep === 1) {
history.push('/steps/2');
return;
}
if (currentStep === 2) {
history.push('/steps/3');
return;
}
const stepsCount = getStepsCount();
if (currentStep === 3 && stepsCount > 3) {
history.push('/steps/4');
return;
}
if (currentStep === 3 && stepsCount === 3) {
finishWizard();
return;
}
if (currentStep === 4) {
if (currentStep < stepsCount) {
history.push(`/steps/${currentStep + 1}`);
} else {
finishWizard();
}
};