yapi/client/reducer/modules/follow.js

35 lines
578 B
JavaScript
Raw Normal View History

2017-08-15 12:08:59 +08:00
import axios from 'axios';
// Actions
const GET_FOLLOW_LIST = 'yapi/follow/GET_FOLLOW_LIST';
// Reducer
const initialState = {
data: []
};
export default (state = initialState, action) => {
switch (action.type) {
case GET_FOLLOW_LIST: {
console.log(action);
return {
...state,
data: action.payload.data.data
};
}
default:
return state;
}
};
// Action Creators
export function getFollowList(uid) {
return {
type: GET_FOLLOW_LIST,
payload: axios.get('/api/follow/list', {
params: { uid }
})
}
}