discourse/app/assets/javascripts/wizard/addon/controllers/wizard-step.js
David Taylor 48193767bf DEV: Sort imports
Automatically generated by `eslint --fix` to satisfy the updated configuration
2023-10-10 21:46:54 +01:00

30 lines
739 B
JavaScript

import Controller from "@ember/controller";
import { action } from "@ember/object";
import { inject as service } from "@ember/service";
import getUrl from "discourse-common/lib/get-url";
export default Controller.extend({
router: service(),
wizard: null,
step: null,
@action
goNext(response) {
const next = this.get("step.next");
if (response?.refresh_required) {
document.location = getUrl(`/wizard/steps/${next}`);
} else if (response?.success && next) {
this.router.transitionTo("wizard.step", next);
} else if (response?.success) {
this.router.transitionTo("discovery.latest");
}
},
@action
goBack() {
this.router.transitionTo("wizard.step", this.step.previous);
},
});