custom-step.js.es6 563 B

1234567891011121314151617181920
  1. import StepController from 'wizard/controllers/step';
  2. import getUrl from 'discourse-common/lib/get-url';
  3. export default StepController.extend({
  4. actions: {
  5. goNext(response) {
  6. const next = this.get('step.next');
  7. if (response.refresh_required) {
  8. const id = this.get('wizard.id');
  9. document.location = getUrl(`/wizard/custom/${id}/steps/${next}`);
  10. } else {
  11. this.transitionToRoute('custom.step', next);
  12. }
  13. },
  14. goBack() {
  15. this.transitionToRoute('custom.step', this.get('step.previous'));
  16. }
  17. }
  18. });