Read both farmmaps currentuser and authenticate userinfo
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Router } from '@angular/router';
|
||||
import { OAuthService } from 'angular-oauth2-oidc';
|
||||
import { OAuthService,UserInfo } from 'angular-oauth2-oidc';
|
||||
import { Store, Action } from '@ngrx/store';
|
||||
import { Effect, Actions,ofType } from '@ngrx/effects';
|
||||
import { Observable , defer , of } from 'rxjs';
|
||||
import { Observable , defer , of,from } from 'rxjs';
|
||||
import { withLatestFrom,mergeMap,switchMap,map,catchError} from 'rxjs/operators';
|
||||
import * as appCommonActions from '../actions/app-common.actions';
|
||||
import * as appCommonReducers from '../reducers/app-common.reducer';
|
||||
@@ -44,9 +44,10 @@ export class AppCommonEffects {
|
||||
ofType(appCommonActions.INITUSER),
|
||||
withLatestFrom(this.store$.select(appCommonReducers.selectGetInitialized)),
|
||||
switchMap(([action, initialized]) => {
|
||||
if(!initialized) {
|
||||
if(!initialized) {
|
||||
return this.userService$.getCurrentUser().pipe(
|
||||
map((user: IUser) => new appCommonActions.InitUserSuccess(user)),
|
||||
withLatestFrom(from(this.oauthService$.loadUserProfile())),
|
||||
switchMap(([user,userInfo]) => {return of(new appCommonActions.InitUserSuccess(user,userInfo as UserInfo))} ),
|
||||
catchError(error => of(new appCommonActions.Fail(error))))
|
||||
} else {
|
||||
return [];
|
||||
|
Reference in New Issue
Block a user