我无法在Redux-Saga中对有效负载采取行动

时间:2019-04-20 07:18:10

标签: javascript redux-saga

我在redux-saga中放置了带有有效负载的动作,该动作是有效的,但无法获取有效负载

动作:

export const takeKey = createAction("TAKE_KEY_REQUEST", data => {
  //when it come from redux-saga,it does't console
  console.log("data",data) 
  return data;
});

redux-saga

//in this function,I put action
function* loginAsync(action) {
  yield put({type:"TAKE_KEY_REQUEST",payload:{test:"test"}})
}

//this get type:"TAKE_KEY_REQUEST"
function* takeKeyAsync(action) {
  //console
  //from page:action,{type:"TAKE_KEY_REQUEST",payload:{}}
  //from saga:action,{type: "TAKE_KEY_REQUEST", @@redux-saga/SAGA_ACTION: true}
  console.log("action",action)
}

0 个答案:

没有答案