[Library]: Fix isLogged in function

git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-library/trunk/ng-openaire-library/src/app@57075 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
k.triantafyllou 2019-09-13 10:02:30 +00:00
parent 7955acd2bc
commit a77afb15c9
2 changed files with 4 additions and 13 deletions

View File

@ -1,5 +1,5 @@
import { Injectable } from '@angular/core'; import {Injectable} from '@angular/core';
import {Router, CanActivate, ActivatedRouteSnapshot, RouterStateSnapshot, Route, CanLoad} from '@angular/router'; import {ActivatedRouteSnapshot, CanActivate, CanLoad, Route, Router, RouterStateSnapshot} from '@angular/router';
import {Observable} from 'rxjs/Observable'; import {Observable} from 'rxjs/Observable';
import {Session} from './utils/helper.class'; import {Session} from './utils/helper.class';
import {LoginErrorCodes} from './utils/guardHelper.class'; import {LoginErrorCodes} from './utils/guardHelper.class';

View File

@ -23,19 +23,10 @@ export class Session{
return this.getUserFromCookie(); return this.getUserFromCookie();
} }
public static isLoggedIn(): boolean { public static isLoggedIn(): boolean {
var loggedIn:boolean = false;
var user:User = null;
var cookie= COOKIE.getCookie(COOKIE.cookieName_id); var cookie= COOKIE.getCookie(COOKIE.cookieName_id);
if(cookie == null ||cookie == ""){ return (cookie != null && cookie != "");
return false;
}else{
var user:User = this.getUserFromCookie();
if(user ==null){
return false;
}
return true;
}
} }
public static getUserFromCookie():User{ public static getUserFromCookie():User{
var cookie= COOKIE.getCookie(COOKIE.cookieName_u); var cookie= COOKIE.getCookie(COOKIE.cookieName_u);
if(cookie != null && cookie!=""){ if(cookie != null && cookie!=""){