diff --git a/assets/javascripts/wizard/controllers/custom-step.js.es6 b/assets/javascripts/wizard/controllers/custom-step.js.es6 index 01f02753..1881764c 100644 --- a/assets/javascripts/wizard/controllers/custom-step.js.es6 +++ b/assets/javascripts/wizard/controllers/custom-step.js.es6 @@ -5,8 +5,8 @@ export default StepController.extend({ actions: { goNext(response) { const next = this.get('step.next'); - if (response.route_to) { - window.location.href = response.route_to; + if (response.redirect_on_next) { + window.location.href = response.redirect_on_next; } else if (response.refresh_required) { const id = this.get('wizard.id'); window.location.href = getUrl(`/w/${id}/steps/${next}`); diff --git a/lib/builder.rb b/lib/builder.rb index c823ee75..73248d0d 100644 --- a/lib/builder.rb +++ b/lib/builder.rb @@ -161,12 +161,10 @@ class CustomWizard::Builder end if updater.errors.empty? - if route_to = data['route_to'] - updater.result[:route_to] = route_to - end - - if redirect_on_complete = data['redirect_on_complete'] - updater.result[:redirect_on_complete] = redirect_on_complete + if final_step + updater.result[:redirect_on_complete] = data['redirect_on_complete'] || data['route_to'] + elsif route_to = data['route_to'] + updater.result[:redirect_on_next] = route_to end end end