0
0
Fork 1
Spiegel von https://github.com/paviliondev/discourse-custom-wizard.git synchronisiert 2024-11-22 01:10:28 +01:00

add router service to controllers to avoid deprecation

Dieser Commit ist enthalten in:
merefield 2023-09-14 14:58:34 +01:00
Ursprung 33a320021f
Commit 742239b023
2 geänderte Dateien mit 8 neuen und 3 gelöschten Zeilen

Datei anzeigen

@ -7,8 +7,11 @@ import { selectKitContent } from "../lib/wizard";
import { underscore } from "@ember/string"; import { underscore } from "@ember/string";
import Controller from "@ember/controller"; import Controller from "@ember/controller";
import I18n from "I18n"; import I18n from "I18n";
import { inject as service } from '@ember/service';
export default Controller.extend({ export default Controller.extend({
router: service(),
queryParams: ["refresh_list"], queryParams: ["refresh_list"],
loadingSubscriptions: false, loadingSubscriptions: false,
notAuthorized: not("api.authorized"), notAuthorized: not("api.authorized"),
@ -248,7 +251,7 @@ export default Controller.extend({
.catch(popupAjaxError) .catch(popupAjaxError)
.then((result) => { .then((result) => {
if (result.success) { if (result.success) {
this.transitionToRoute("adminWizardsApis").then(() => { this.router.transitionToRoute("adminWizardsApis").then(() => {
this.send("refreshModel"); this.send("refreshModel");
}); });
} }

Datei anzeigen

@ -1,7 +1,9 @@
import Controller from "@ember/controller"; import Controller from "@ember/controller";
import getUrl from "discourse-common/lib/get-url"; import getUrl from "discourse-common/lib/get-url";
import { inject as service } from '@ember/service';
export default Controller.extend({ export default Controller.extend({
router: service(),
wizard: null, wizard: null,
step: null, step: null,
@ -15,12 +17,12 @@ export default Controller.extend({
const wizardId = this.get("wizard.id"); const wizardId = this.get("wizard.id");
window.location.href = getUrl(`/w/${wizardId}/steps/${nextStepId}`); window.location.href = getUrl(`/w/${wizardId}/steps/${nextStepId}`);
} else { } else {
this.transitionToRoute("customWizardStep", nextStepId); this.router.transitionToRoute("customWizardStep", nextStepId);
} }
}, },
goBack() { goBack() {
this.transitionToRoute("customWizardStep", this.get("step.previous")); this.router.transitionToRoute("customWizardStep", this.get("step.previous"));
}, },
showMessage(message) { showMessage(message) {