more checks for reload not to lose parameters and to set them properly

git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-library/trunk/ng-openaire-library/src/app@52646 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
argiro.kokogiannaki 2018-07-02 13:42:20 +00:00
parent a180be6167
commit fb74882c1f
3 changed files with 13 additions and 14 deletions

View File

@ -121,14 +121,14 @@ export class UserMiniComponent {
} }
} }
gotoUserPage(){ // gotoUserPage(){
this.redirectUrl = this.location.path(); // this.redirectUrl = this.location.path();
if(this.redirectUrl && this.redirectUrl != null && this.redirectUrl != "" && this.redirectUrl !="user-info"){ // if(this.redirectUrl && this.redirectUrl != null && this.redirectUrl != "" && this.redirectUrl !="user-info"){
this.router.navigate([this.baseUrl], { queryParams: this.routerHelper.createQueryParam("redirectUrl",this.redirectUrl )}); // this.router.navigate([this.baseUrl], { queryParams: this.routerHelper.createQueryParam("redirectUrl",this.redirectUrl )});
}else{ // }else{
this.router.navigate([this.baseUrl]); // this.router.navigate([this.baseUrl]);
} // }
} // }
logOut(){ logOut(){
if(Session.isLoggedIn()){ if(Session.isLoggedIn()){
Session.removeUser(); Session.removeUser();

View File

@ -104,12 +104,11 @@ export class Session{
} }
public static getParamsObj(params:string) { public static getParamsObj(params:string) {
var object = null; var object = null;
if(params.split("&").length > 0){ if(params.split("&").length > 0){
object = {}; object = {};
} }
params =(params && params.split("?").length > 0 )?params.split("?")[1]:params; params =(params && params.split("?").length > 1 )?params.split("?")[1]:params;
for(var i=0; i<params.split("&").length; i++){ for(var i=0; i<params.split("&").length; i++){
object[(params.split("&")[i]).split("=")[0]] = (params.split("&")[i]).split("=")[1]; object[(params.split("&")[i]).split("=")[0]] = (params.split("&")[i]).split("=")[1];
} }

View File

@ -40,7 +40,7 @@ export class ReloadComponent {
if(URL && URL["path"] && URL["path"] != null && URL["path"] != ""){ if(URL && URL["path"] && URL["path"] != null && URL["path"] != ""){
var url = URL["path"]; var url = URL["path"];
var host = URL["host"]; var host = URL["host"];
var paramsObject = Session.getParamsObj(URL["params"]); var paramsObject = ((URL["params"] && URL["params"] != null)? Session.getParamsObj(URL["params"]):null);
if(host == (location.protocol+"//"+location.host)){ if(host == (location.protocol+"//"+location.host)){
if(paramsObject && paramsObject != null){ if(paramsObject && paramsObject != null){
Session.setReloadUrl("","","") Session.setReloadUrl("","","")
@ -51,7 +51,7 @@ export class ReloadComponent {
} }
}else{ }else{
Session.setReloadUrl("","","") Session.setReloadUrl("","","")
window.location.href = host+url+URL["params"]; window.location.href = host+url+((URL["params"] && URL["params"] !=null)?((URL["params"].indexOf("?")==-1?"?":"")+URL["params"]):"");
} }
}else{ }else{