2022-06-17 08:50:21 -04:00
|
|
|
import getUrl from "discourse-common/lib/get-url";
|
|
|
|
import Controller from "@ember/controller";
|
|
|
|
import { action } from "@ember/object";
|
|
|
|
|
|
|
|
export default Controller.extend({
|
|
|
|
wizard: null,
|
|
|
|
step: null,
|
|
|
|
|
|
|
|
@action
|
|
|
|
goNext(response) {
|
|
|
|
const next = this.get("step.next");
|
|
|
|
|
|
|
|
if (response?.refresh_required) {
|
|
|
|
document.location = getUrl(`/wizard/steps/${next}`);
|
2022-08-02 04:43:25 -04:00
|
|
|
} else if (response?.success && next) {
|
2022-06-17 08:50:21 -04:00
|
|
|
this.transitionToRoute("wizard.step", next);
|
2022-08-02 04:43:25 -04:00
|
|
|
} else if (response?.success) {
|
|
|
|
this.transitionToRoute("discovery.latest");
|
2022-06-17 08:50:21 -04:00
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
@action
|
|
|
|
goBack() {
|
|
|
|
this.transitionToRoute("wizard.step", this.step.previous);
|
|
|
|
},
|
|
|
|
});
|