FIX: discourse client should know about Logster (#7232)

This commit is contained in:
Osama Sayegh 2019-03-21 16:54:55 +03:00 committed by GitHub
parent 605530a77f
commit bfcbc4d2d6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 22 additions and 0 deletions

View File

@ -3,6 +3,10 @@ export default function() {
this.route("exception", { path: "/exception" });
this.route("exception-unknown", { path: "/404" });
this.route("logster", { path: "/logs" }, function() {
this.route("logster-routes", { path: "*path" });
});
this.route("about", { path: "/about", resetNamespace: true });
this.route("post", { path: "/p/:id" });

View File

@ -0,0 +1,18 @@
import getURL from "discourse-common/lib/get-url";
import { getOwner } from "discourse-common/lib/get-owner";
export default Discourse.Route.extend({
beforeModel(transition) {
const router = getOwner(this).lookup("router:main");
const currentURL = router.get("currentURL");
transition.abort();
// hack due to Ember bug https://github.com/emberjs/ember.js/issues/5210
// aborting the transition should revert the address bar to the
// previous route's url, otherwise we will end up with a broken
// back button
// workaround is to update the address bar ourselves
router.location.setURL(router.url);
window.location.href = getURL(currentURL);
}
});