重置-Redux抛出无效操作:未定义

重置-Redux抛出无效操作:未定义,redux,ngrx,ngrx-store,ngrx-effects,ngrx-entity,Redux,Ngrx,Ngrx Store,Ngrx Effects,Ngrx Entity,我正在尝试根据注销重置我的redux存储,但出现以下错误。寻找更好的建议来重置我的redux存储状态,以便在我发现的任何地方将其设置为undefined将有助于解决这个问题,但在我的情况下,它不起作用 /** * Our state is composed of a map of action reducer functions. * Here we are going to reset the state of root reducer to undefined to clear

我正在尝试根据注销重置我的redux存储,但出现以下错误。寻找更好的建议来重置我的redux存储状态,以便在我发现的任何地方将其设置为undefined将有助于解决这个问题,但在我的情况下,它不起作用

    /**
 * Our state is composed of a map of action reducer functions.
 * Here we are going to reset the state of root reducer to undefined to clear data store
 * Logged Action is triggered from User session effects.
 */
export function resetState(reducer: ActionReducer<State>): ActionReducer<State> {
  return function (state: State, action: UserSessionActions.UserSessionActionsUnion): State {

    switch (action.type) {
      case UserSessionActions.UserSessionActionTypes.LoggedOut: {
        state = undefined;
        return reducer(state, action);
      }
      default: {
        return reducer(state, action);
      }
    }
  };
}
这是我的效果

    @Effect()
  logout$ = this.actions$.pipe(
    ofType(UserSessionActions.UserSessionActionTypes.LoggedOut),
    map((action: any) => {
      this.logger.log('logout ' + JSON.stringify(action));
      return Observable.of({});
    }),
    catchError((err) => {
      this.logger.log(err);
      return Observable.of();
    })
  );
错误:Effect“UserSessionEffects.logout$”调度了无效操作

ngrx/effect必须返回一个动作(一个具有type属性的对象),除非它被修饰为
@effect({dispatch:false})

更新效果以返回操作:

return Observable.of({ type: 'LOGGED OUT SUCCESS'});
错误:Effect“UserSessionEffects.logout$”调度了无效操作

ngrx/effect必须返回一个动作(一个具有type属性的对象),除非它被修饰为
@effect({dispatch:false})

更新效果以返回操作:

return Observable.of({ type: 'LOGGED OUT SUCCESS'});
@效果({dispatch:false})在我返回类型中的字符串时起作用,但得到的结果相同error@Effect({dispatch:false})的工作原理与我返回类型中的字符串相同,但得到的错误相同