Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- type PermittedActions = AuthSignInAction & AuthSignOutAction & AuthRefreshTokenAction & UserAction;
- interface Handler {
- [key: string]: any;
- }
- export function createReducer<State>(
- initialState: State,
- handler: Handler,
- ): Reducer<State> {
- return (state: State = initialState, action: PermittedActions): State => {
- console.log('TYPE', action.type)
- if (handler[action.type]) {
- return handler[action.type](state, action);
- }
- return state;
- };
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement