2021-04-30 12:14:16 -04:00
|
|
|
import getUrl from "discourse-common/lib/get-url";
|
2019-10-23 13:06:54 -04:00
|
|
|
import Controller from "@ember/controller";
|
2021-04-30 12:14:16 -04:00
|
|
|
|
2019-10-23 13:06:54 -04:00
|
|
|
export default Controller.extend({
|
2016-08-25 13:14:56 -04:00
|
|
|
wizard: null,
|
2016-08-24 14:35:07 -04:00
|
|
|
step: null,
|
2016-08-25 13:14:56 -04:00
|
|
|
|
|
|
|
actions: {
|
2016-09-07 18:04:01 -04:00
|
|
|
goNext(response) {
|
|
|
|
const next = this.get("step.next");
|
2021-12-16 17:17:36 -05:00
|
|
|
if (response && response.refresh_required) {
|
2021-04-30 12:14:16 -04:00
|
|
|
if (this.get("step.id") === "locale") {
|
|
|
|
document.location = getUrl(`/wizard/steps/${next}`);
|
|
|
|
return;
|
|
|
|
} else {
|
|
|
|
this.send("refresh");
|
|
|
|
}
|
2016-09-07 18:04:01 -04:00
|
|
|
}
|
2021-12-16 17:17:36 -05:00
|
|
|
if (response && response.success) {
|
|
|
|
this.transitionToRoute("step", next);
|
|
|
|
}
|
2016-08-25 13:14:56 -04:00
|
|
|
},
|
|
|
|
goBack() {
|
|
|
|
this.transitionToRoute("step", this.get("step.previous"));
|
|
|
|
},
|
|
|
|
},
|
2016-08-24 14:35:07 -04:00
|
|
|
});
|