2022-06-17 20:50:21 +08:00
|
|
|
import getUrl from "discourse-common/lib/get-url";
|
|
|
|
import Controller from "@ember/controller";
|
|
|
|
import { action } from "@ember/object";
|
2023-07-19 03:53:23 +08:00
|
|
|
import { inject as service } from "@ember/service";
|
2022-06-17 20:50:21 +08:00
|
|
|
|
|
|
|
export default Controller.extend({
|
2023-07-19 03:53:23 +08:00
|
|
|
router: service(),
|
|
|
|
|
2022-06-17 20:50:21 +08:00
|
|
|
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 16:43:25 +08:00
|
|
|
} else if (response?.success && next) {
|
2023-07-19 03:53:23 +08:00
|
|
|
this.router.transitionTo("wizard.step", next);
|
2022-08-02 16:43:25 +08:00
|
|
|
} else if (response?.success) {
|
2023-07-19 03:53:23 +08:00
|
|
|
this.router.transitionTo("discovery.latest");
|
2022-06-17 20:50:21 +08:00
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
@action
|
|
|
|
goBack() {
|
2023-07-19 03:53:23 +08:00
|
|
|
this.router.transitionTo("wizard.step", this.step.previous);
|
2022-06-17 20:50:21 +08:00
|
|
|
},
|
|
|
|
});
|