我的数据返回原型对象Redux与传奇

时间:2018-04-21 17:38:48

标签: reactjs redux async-await redux-saga

我想得到我的ACTIONS状态:LOAD_GROUP但是对象返回我 proto:对象 enter image description here

我的sagas.js

##//SAGAS ##
import { loadGroup } from "../actions/Group"

export function* loadApiDataGroup() {
  try {
    // API 
        const response = yield call(axios.get, 'http://localhost:8000/api/group');
        yield put(loadGroup(response))
  } catch (e) {
    console.log('REQUEST FAILED! Could not get group.')
    console.log(e)
  }
}

export default function* mySaga() {
  yield [
    loadApiDataGroup(),
  ]
}

actions.js

##// ACTIONS ##
export function loadGroup(data){ return { type: LOAD_GROUP, data }};

## // REDUCER ##
export default function groupReducer( state= {}, action = {}){
    switch (action.type){
        case LOAD_GROUP:
            return {
                ...state
            }
        default:
            return state
    }
}

root.js

## // ROOT REDUCERS ##
import groupReducer from '../actions/Group'

const reducer = combineReducers({
  groupReducer,
});

我的伙伴

## // COMPONENT ##
const mapStateToProps = (state, props) => {
    console.log(state., "CONSOLE LOG");
    return {
    }
};

const mapDispatchToProps = dispatch => {
    return { actions: bindActionCreators({ loadGroup }, dispatch)};
}

0 个答案:

没有答案