0
0
Fork 1
Spiegel von https://github.com/paviliondev/discourse-custom-wizard.git synchronisiert 2024-11-25 18:50:27 +01:00

Improve redirect code clarity

Dieser Commit ist enthalten in:
Angus McLeod 2019-08-29 09:51:18 +10:00
Ursprung 69c25171d5
Commit ad18ec9809
2 geänderte Dateien mit 6 neuen und 8 gelöschten Zeilen

Datei anzeigen

@ -5,8 +5,8 @@ export default StepController.extend({
actions: { actions: {
goNext(response) { goNext(response) {
const next = this.get('step.next'); const next = this.get('step.next');
if (response.route_to) { if (response.redirect_on_next) {
window.location.href = response.route_to; window.location.href = response.redirect_on_next;
} else if (response.refresh_required) { } else if (response.refresh_required) {
const id = this.get('wizard.id'); const id = this.get('wizard.id');
window.location.href = getUrl(`/w/${id}/steps/${next}`); window.location.href = getUrl(`/w/${id}/steps/${next}`);

Datei anzeigen

@ -161,12 +161,10 @@ class CustomWizard::Builder
end end
if updater.errors.empty? if updater.errors.empty?
if route_to = data['route_to'] if final_step
updater.result[:route_to] = route_to updater.result[:redirect_on_complete] = data['redirect_on_complete'] || data['route_to']
end elsif route_to = data['route_to']
updater.result[:redirect_on_next] = route_to
if redirect_on_complete = data['redirect_on_complete']
updater.result[:redirect_on_complete] = redirect_on_complete
end end
end end
end end