Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import * as t from './actionTypes'
- export const initialState = {
- data: null,
- isLoading: false,
- errorMsg: null,
- }
- export default (state, action) => {
- switch (action.type) {
- case t.NEWS_GET_REQUEST:
- return {
- ...state,
- isLoading: true,
- errorMsg: null,
- }
- case t.NEWS_GET_SUCCESS:
- return {
- ...state,
- isLoading: false,
- data: action.payload,
- }
- case t.NEWS_GET_FAILURE:
- return {
- ...state,
- errorMsg: action.payload.errorMsg,
- }
- default:
- return state
- }
- }
Add Comment
Please, Sign In to add comment