File tree Expand file tree Collapse file tree 2 files changed +6
-10
lines changed Expand file tree Collapse file tree 2 files changed +6
-10
lines changed Original file line number Diff line number Diff line change 11{
22 "name" : " ngx-fusio-sdk" ,
3- "version" : " 7.0.0 " ,
3+ "version" : " 7.0.1 " ,
44 "description" : " SDK to integrate Fusio into an Angular app" ,
55 "keywords" : [
66 " Fusio" ,
Original file line number Diff line number Diff line change @@ -9,24 +9,17 @@ import {ConfigService} from "./config.service";
99} )
1010export class UserService {
1111
12- private user ?: ConsumerUserAccount ;
13-
1412 constructor ( private fusio : FusioService , private config : ConfigService ) { }
1513
1614 public login ( user : ConsumerUserAccount ) : void {
17- this . user = user ;
1815 sessionStorage . setItem ( this . getKey ( ) , JSON . stringify ( user ) ) ;
1916 }
2017
2118 public get ( ) : ConsumerUserAccount | undefined {
22- if ( ! this . fusio . hasValidToken ( ) ) {
19+ if ( ! this . isAuthenticated ( ) ) {
2320 return undefined ;
2421 }
2522
26- if ( this . user ) {
27- return this . user ;
28- }
29-
3023 const rawData = sessionStorage . getItem ( this . getKey ( ) ) ;
3124 if ( ! rawData ) {
3225 return undefined ;
@@ -35,8 +28,11 @@ export class UserService {
3528 return JSON . parse ( rawData ) ;
3629 }
3730
31+ public isAuthenticated ( ) : boolean {
32+ return this . fusio . hasValidToken ( ) ;
33+ }
34+
3835 public logout ( ) : void {
39- this . user = undefined ;
4036 sessionStorage . removeItem ( this . getKey ( ) ) ;
4137 this . fusio . logout ( ) ;
4238 }
You can’t perform that action at this time.
0 commit comments