Advertisement
Guest User

Untitled

a guest
Nov 17th, 2019
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.48 KB | None | 0 0
  1. type PermittedActions = AuthSignInAction & AuthSignOutAction & AuthRefreshTokenAction & UserAction;
  2.  
  3. interface Handler {
  4. [key: string]: any;
  5. }
  6.  
  7. export function createReducer<State>(
  8. initialState: State,
  9. handler: Handler,
  10. ): Reducer<State> {
  11. return (state: State = initialState, action: PermittedActions): State => {
  12. console.log('TYPE', action.type)
  13. if (handler[action.type]) {
  14. return handler[action.type](state, action);
  15. }
  16. return state;
  17. };
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement