[Library | Trunk]: User mini change conditions of redirect url

git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-library/trunk/ng-openaire-library/src/app@59472 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
k.triantafyllou 2020-09-24 12:50:27 +00:00
parent 9261419e2d
commit bee7fcbecd
1 changed files with 13 additions and 15 deletions

View File

@ -184,7 +184,7 @@ export class UserMiniComponent implements OnInit, OnChanges {
constructor(private router: Router, private route: ActivatedRoute) {
this.router.events.forEach(event => {
if(event instanceof NavigationStart) {
if (event instanceof NavigationStart) {
this.initialize(event.url);
}
});
@ -212,20 +212,18 @@ export class UserMiniComponent implements OnInit, OnChanges {
}
initialize(url: string = null) {
if (typeof location !== 'undefined') {
if(url) {
if (url) {
let parts = StringUtils.split(url, ['?']);
this.redirectUrl = properties.baseLink + parts[0];
if(parts.length == 2) {
if (parts.length == 2) {
this.search = parts[1];
} else {
this.search = null;
}
} else {
} else if (typeof location !== 'undefined') {
this.redirectUrl = location.pathname;
this.search = location.search;
}
}
if (this.user) {
this.loggedIn = true;
this.parseName();
@ -243,7 +241,7 @@ export class UserMiniComponent implements OnInit, OnChanges {
if (this.user) {
Session.removeUser();
// New method
if(properties.logoutUrl.includes('openid_logout')) {
if (properties.logoutUrl.includes('openid_logout')) {
Session.setReloadUrl(location.protocol + "//" + location.host, this.redirectUrl, this.search);
window.location.href = this.logOutUrl;
} else {
@ -257,7 +255,7 @@ export class UserMiniComponent implements OnInit, OnChanges {
logIn() {
Session.setReloadUrl(location.protocol + "//" + location.host,
this.fixRedirectUrl?(properties.baseLink + this.fixRedirectUrl):this.redirectUrl, this.search);
this.fixRedirectUrl ? (properties.baseLink + this.fixRedirectUrl) : this.redirectUrl, this.search);
window.location.href = this.logInUrl;
}