mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
DEV: upgrade transitionToRoute on Controller (#22647)
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`)
This commit is contained in:
@@ -1,8 +1,11 @@
|
||||
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,
|
||||
|
||||
@@ -13,14 +16,14 @@ export default Controller.extend({
|
||||
if (response?.refresh_required) {
|
||||
document.location = getUrl(`/wizard/steps/${next}`);
|
||||
} else if (response?.success && next) {
|
||||
this.transitionToRoute("wizard.step", next);
|
||||
this.router.transitionTo("wizard.step", next);
|
||||
} else if (response?.success) {
|
||||
this.transitionToRoute("discovery.latest");
|
||||
this.router.transitionTo("discovery.latest");
|
||||
}
|
||||
},
|
||||
|
||||
@action
|
||||
goBack() {
|
||||
this.transitionToRoute("wizard.step", this.step.previous);
|
||||
this.router.transitionTo("wizard.step", this.step.previous);
|
||||
},
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user