Dva: dispatch:action should be a plain Object with type

Created on 12 Jan 2018  ·  3Comments  ·  Source: dvajs/dva

点击按钮
loginOnPress=(param)=>{
console.log(this.state.password)
this.props.dispatch({
type:'demo/getToken',
shipNumber:this.state.shipNumber,
password:this.state.password,
phone:this.state.phone,
vCode:this.state.vCode,

   })     
}

这是model里的

  • getToken({shipNumber,password,phone,vCode},{put}){
    const res = yield put(service.login,shipNumber,password,phone,vCode)
    console.log(res)
    },
    报标题上的错误

Most helpful comment

I guess you guys use "yield put" to request an API, which is expected "yield call".

All 3 comments

hi I encountered the same problem.

me too, any solution to this problem?

I guess you guys use "yield put" to request an API, which is expected "yield call".

Was this page helpful?
0 / 5 - 0 ratings