AW-1419
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good

This commit is contained in:
Willem Dantuma
2020-08-04 16:09:22 +02:00
parent 309b320534
commit ee7d1cb9a2
2 changed files with 26 additions and 6 deletions

View File

@@ -57,24 +57,37 @@ export class AppCommonEffects {
catchError(error => of(new appCommonActions.Fail(error))))
}
));
@Effect()
initUserPackages$:Observable<Action> = this.actions$.pipe(
ofType(appCommonActions.INITUSERSUCCESS),
switchMap((action) => {
let a = action as appCommonActions.InitUserSuccess;
return this.itemService$.getChildItemList(a.user.code+":USER_PACKAGES","vnd.farmmaps.itemtype.package").pipe(
ofType(appCommonActions.INITUSERPACKAGES),
withLatestFrom(this.store$.select(appCommonReducers.SelectGetUser)),
switchMap(([action,user]) => {
return this.itemService$.getChildItemList(user.code+":USER_PACKAGES","vnd.farmmaps.itemtype.package").pipe(
switchMap((items) => of(new appCommonActions.InitUserPackagesSuccess(items))),
catchError(error => of(new appCommonActions.Fail(error)))
)
})
);
@Effect()
userPackagesChanged$:Observable<Action> = this.actions$.pipe(
ofType(appCommonActions.ITEMCHANGEDEVENT),
switchMap((action) => {
let a = action as appCommonActions.ItemChangedEvent;
if(a.itemCode.endsWith(":USER_PACKAGES"))
return of(new appCommonActions.InitUserPackages());
else
return of(undefined);
})
);
@Effect()
initUserSuccess$: Observable<Action> = this.actions$.pipe(
ofType(appCommonActions.INITUSERSUCCESS),
switchMap(() => {
return of(new appCommonActions.InitRoot());
return [new appCommonActions.InitRoot(),new appCommonActions.InitUserPackages()];
}
));