Skip to content

Instantly share code, notes, and snippets.

@codeBelt
Last active August 8, 2019 20:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save codeBelt/af08ecdd53498e042b7a3d68db6bc5c1 to your computer and use it in GitHub Desktop.
Save codeBelt/af08ecdd53498e042b7a3d68db6bc5c1 to your computer and use it in GitHub Desktop.
import I__store__ReducerState from './models/I__store__ReducerState';
import IAction from '../IAction';
import __store__Action, {__store__ActionUnion} from './__store__Action';
import __model__ResponseModel from './models/__model__ResponseModel';
export default class __store__Reducer {
private static readonly _initialState: I__store__ReducerState = {
isLoading__model__: false,
__model__(camelCase): null,
};
public static reducer(state: I__store__ReducerState = __store__Reducer._initialState, action: IAction<__store__ActionUnion>): I__store__ReducerState {
switch (action.type) {
case __store__Action.LOAD___model__(constantCase):
return {
...state,
isLoading__model__: true,
};
case __store__Action.LOAD___model__(constantCase)_SUCCESS:
return {
...state,
isLoading__model__: false,
__model__(camelCase): action.payload as __model__ResponseModel,
};
default:
return state;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment