Add action logging and some refactoring
This commit is contained in:
@@ -129,7 +129,7 @@ export class MapEffects {
|
||||
),
|
||||
catchError(error => of(new commonActions.Fail(error))));
|
||||
} else {
|
||||
newAction= of(new commonActions.Escape(true,false));
|
||||
return [];
|
||||
}
|
||||
return newAction;
|
||||
}));
|
||||
@@ -251,27 +251,39 @@ export class MapEffects {
|
||||
@Effect()
|
||||
setQueryState$: Observable<Action> = this.actions$.pipe(
|
||||
ofType(mapActions.SETQUERYSTATE),
|
||||
switchMap((action: mapActions.SetQueryState) => {
|
||||
var newAction:Action;
|
||||
if (action.queryState.itemCode && action.queryState.itemCode != "") {
|
||||
newAction= new mapActions.SelectItem(action.queryState.itemCode);
|
||||
withLatestFrom(this.store$.select(mapReducers.selectGetInSearch)),
|
||||
switchMap(([action,inSearch]) => {
|
||||
if(!inSearch) {
|
||||
let a = action as mapActions.SetQueryState;
|
||||
var newAction:Action;
|
||||
if (a.queryState.itemCode && a.queryState.itemCode != "") {
|
||||
newAction= new mapActions.SelectItem(a.queryState.itemCode);
|
||||
} else {
|
||||
newAction= new mapActions.StartSearch(a.queryState);
|
||||
}
|
||||
return of(newAction);
|
||||
} else {
|
||||
newAction= new mapActions.StartSearch(action.queryState);
|
||||
return [];
|
||||
}
|
||||
return of(newAction);
|
||||
}));
|
||||
|
||||
@Effect()
|
||||
setState$: Observable<Action> = this.actions$.pipe(
|
||||
ofType(mapActions.SETSTATE),
|
||||
switchMap((action: mapActions.SetState) => {
|
||||
var newAction:Action;
|
||||
if (action.queryState.itemCode && action.queryState.itemCode != "") {
|
||||
newAction= new mapActions.SelectItem(action.queryState.itemCode);
|
||||
withLatestFrom(this.store$.select(mapReducers.selectGetInSearch)),
|
||||
switchMap(([action,inSearch]) => {
|
||||
if(!inSearch) {
|
||||
let a = action as mapActions.SetQueryState;
|
||||
var newAction:Action;
|
||||
if (a.queryState.itemCode && a.queryState.itemCode != "") {
|
||||
newAction= new mapActions.SelectItem(a.queryState.itemCode);
|
||||
} else {
|
||||
newAction= new mapActions.StartSearch(a.queryState);
|
||||
}
|
||||
return of(newAction);
|
||||
} else {
|
||||
newAction= new mapActions.StartSearch(action.queryState);
|
||||
return [];
|
||||
}
|
||||
return of(newAction);
|
||||
}));
|
||||
|
||||
constructor(private actions$: Actions, private store$: Store<mapReducers.State>, private folderService$: FolderService, private itemService$: ItemService,private featureIconService$:FeatureIconService,private itemTypeService$:ItemTypeService) {
|
||||
|
Reference in New Issue
Block a user