mirror of
https://github.com/discourse/discourse.git
synced 2024-11-29 04:18:24 +08:00
a2ea9c5417
Per https://deprecations.emberjs.com/v3.x/#toc_routing-transition-methods We are upgrading all `this.transitionToRoute` calls on controllers to directly call the router service (`this.router.transitionTo`)
30 lines
739 B
JavaScript
30 lines
739 B
JavaScript
import getUrl from "discourse-common/lib/get-url";
|
|
import Controller from "@ember/controller";
|
|
import { action } from "@ember/object";
|
|
import { inject as service } from "@ember/service";
|
|
|
|
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);
|
|
},
|
|
});
|