File tree Expand file tree Collapse file tree 2 files changed +14
-0
lines changed Expand file tree Collapse file tree 2 files changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -55,4 +55,9 @@ export class UserSelectors {
5555 static isAuthenticated ( state : UserStateModel ) : boolean {
5656 return ! ! state . currentUser . data || ! ! localStorage . getItem ( 'currentUser' ) ;
5757 }
58+
59+ @Selector ( [ UserState ] )
60+ static getActiveFlags ( state : UserStateModel ) : string [ ] {
61+ return state . activeFlags || [ ] ;
62+ }
5863}
Original file line number Diff line number Diff line change @@ -34,6 +34,12 @@ export class UserState {
3434 @Action ( GetCurrentUser )
3535 getCurrentUser ( ctx : StateContext < UserStateModel > ) {
3636 const currentUser = localStorage . getItem ( 'currentUser' ) ;
37+ const activeFlags = localStorage . getItem ( 'activeFlags' ) ;
38+ if ( activeFlags ) {
39+ ctx . patchState ( {
40+ activeFlags : JSON . parse ( activeFlags ) ,
41+ } ) ;
42+ }
3743
3844 if ( currentUser ) {
3945 const parsedUser = JSON . parse ( currentUser ) ;
@@ -70,6 +76,9 @@ export class UserState {
7076 if ( data . currentUser ) {
7177 localStorage . setItem ( 'currentUser' , JSON . stringify ( data . currentUser ) ) ;
7278 }
79+ if ( data . activeFlags ) {
80+ localStorage . setItem ( 'activeFlags' , JSON . stringify ( data . activeFlags ) ) ;
81+ }
7382 } )
7483 ) ;
7584 }
You can’t perform that action at this time.
0 commit comments