mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
fix: The /logout route should always full page reload (#10277)
This commit is contained in:
parent
dd2192cccc
commit
a55b42d11f
@ -6,10 +6,13 @@ import appEvents from 'app/core/app_events';
|
||||
// Good for communication react > angular and vice verse
|
||||
export class GlobalEventSrv {
|
||||
private appSubUrl;
|
||||
private fullPageReloadRoutes;
|
||||
|
||||
|
||||
/** @ngInject */
|
||||
constructor(private $location, private $timeout) {
|
||||
constructor(private $location, private $timeout, private $window) {
|
||||
this.appSubUrl = config.appSubUrl;
|
||||
this.fullPageReloadRoutes = ['/logout'];
|
||||
}
|
||||
|
||||
// Angular's $location does not like <base href...> and absolute urls
|
||||
@ -26,9 +29,13 @@ export class GlobalEventSrv {
|
||||
init() {
|
||||
appEvents.on('location-change', payload => {
|
||||
const urlWithoutBase = this.stripBaseFromUrl(payload.href);
|
||||
if (this.fullPageReloadRoutes.indexOf(urlWithoutBase) > -1) {
|
||||
this.$window.location.href = payload.href;
|
||||
return;
|
||||
}
|
||||
|
||||
this.$timeout(() => { // A hack to use timeout when we're changing things (in this case the url) from outside of Angular.
|
||||
this.$location.url(urlWithoutBase);
|
||||
this.$location.url(urlWithoutBase);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user