Last active
August 8, 2019 20:15
-
-
Save codeBelt/af08ecdd53498e042b7a3d68db6bc5c1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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