yapi/client/reducer/news/news.js
2017-07-20 16:30:55 +08:00

32 lines
543 B
JavaScript

import {
FETCH_NEWS_DATA,
FETCH_MORE_NEWS
} from '../../constants/action-types.js'
const initialState = {
newsData: {}
}
export default (state = initialState, action) => {
switch (action.type) {
case FETCH_NEWS_DATA: {
return {
...state,
newsData: action.payload
};
}
case FETCH_MORE_NEWS: {
// console.log(action.payload);
return {
newsData: {
...state.newsData,
newsList: action.payload
}
}
}
default:
return state;
}
}