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