Skip to content

Commit

Permalink
add router service to controllers to avoid deprecation
Browse files Browse the repository at this point in the history
  • Loading branch information
merefield committed Sep 14, 2023
1 parent 33a3200 commit 742239b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,11 @@ import { selectKitContent } from "../lib/wizard";
import { underscore } from "@ember/string";
import Controller from "@ember/controller";
import I18n from "I18n";
import { inject as service } from '@ember/service';

export default Controller.extend({
router: service(),

queryParams: ["refresh_list"],
loadingSubscriptions: false,
notAuthorized: not("api.authorized"),
Expand Down Expand Up @@ -248,7 +251,7 @@ export default Controller.extend({
.catch(popupAjaxError)
.then((result) => {
if (result.success) {
this.transitionToRoute("adminWizardsApis").then(() => {
this.router.transitionToRoute("adminWizardsApis").then(() => {
this.send("refreshModel");
});
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import Controller from "@ember/controller";
import getUrl from "discourse-common/lib/get-url";
import { inject as service } from '@ember/service';

export default Controller.extend({
router: service(),
wizard: null,
step: null,

Expand All @@ -15,12 +17,12 @@ export default Controller.extend({
const wizardId = this.get("wizard.id");
window.location.href = getUrl(`/w/${wizardId}/steps/${nextStepId}`);
} else {
this.transitionToRoute("customWizardStep", nextStepId);
this.router.transitionToRoute("customWizardStep", nextStepId);
}
},

goBack() {
this.transitionToRoute("customWizardStep", this.get("step.previous"));
this.router.transitionToRoute("customWizardStep", this.get("step.previous"));
},

showMessage(message) {
Expand Down

0 comments on commit 742239b

Please sign in to comment.