Angular 2 - 防止NGRX存储保存以前的事件

时间:2017-04-14 06:51:10

标签: angular redux ngrx

如何阻止ngrx商店保存以前的所有活动?我有一个USER_WAS_ACTIVE操作,每次用户移动鼠标或其他东西时都会重置注销时间。当然,我不希望大量的事件填满记忆。

此外,我想在一个用户注销时手动清除商店,因此下一个用户只能打开redux devtools并查看之前的用户使用该应用程序做了什么。

1 个答案:

答案 0 :(得分:0)

请参阅https://netbasal.com/how-to-secure-your-users-data-after-logout-in-redux-30468c6848e8

const reducers = {
   xxx: xxxReducer
};

export const rootReducer = (state, action) => {
  if (action.type === USER_LOGOUT) {
    state = undefined;
  }

 return combineReducers(reducers)(state, action);
};