2017-07-17 12:15:21 +08:00
|
|
|
import {
|
2017-07-18 10:17:07 +08:00
|
|
|
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
|
|
|
|
};
|
|
|
|
}
|
2017-07-18 10:17:07 +08:00
|
|
|
case FETCH_MORE_NEWS: {
|
2017-07-20 16:30:55 +08:00
|
|
|
// console.log(action.payload);
|
2017-07-18 10:17:07 +08:00
|
|
|
return {
|
2017-07-20 16:30:55 +08:00
|
|
|
newsData: {
|
|
|
|
...state.newsData,
|
|
|
|
newsList: action.payload
|
|
|
|
}
|
2017-07-18 10:17:07 +08:00
|
|
|
}
|
|
|
|
}
|
2017-07-17 12:15:21 +08:00
|
|
|
default:
|
|
|
|
return state;
|
|
|
|
}
|
|
|
|
}
|
2017-07-18 10:17:07 +08:00
|
|
|
|