yapi/client/reducer/news/news.js

32 lines
543 B
JavaScript
Raw Normal View History

2017-07-17 12:15:21 +08:00
import {
FETCH_NEWS_DATA,
FETCH_MORE_NEWS
2017-07-17 12:15:21 +08:00
} from '../../constants/action-types.js'
const initialState = {
2017-07-20 16:30:55 +08:00
newsData: {}
2017-07-17 12:15:21 +08:00
}
export default (state = initialState, action) => {
switch (action.type) {
case FETCH_NEWS_DATA: {
return {
...state,
newsData: action.payload
};
}
case FETCH_MORE_NEWS: {
2017-07-20 16:30:55 +08:00
// console.log(action.payload);
return {
2017-07-20 16:30:55 +08:00
newsData: {
...state.newsData,
newsList: action.payload
}
}
}
2017-07-17 12:15:21 +08:00
default:
return state;
}
}