saga.js
import { delay } from 'redux-saga'
import { put, takeLatest, all } from 'redux-saga/effects'
import axios from 'axios';
function fire(data) {
return axios.post('http://localhost:3131/createUserBusinessInfo', data).then(function (response) {
return response;
}).catch(function (error) {
return error;
});
}
export function* createUserBusinessInfo(action) {
console.log(UserBusinessInfoService)
const userData = yield call(fire, action);
yield put({
type: 'CREATE_USER_BUSINESS_INFO',
userData
});
}
export function* createUserBusinessInfoSaga() {
yield takeLatest('CREATE_USER_BUSINESS_INFO_SAGA', createUserBusinessInfo);
}
export default function* rootSaga() {
yield all([
helloSaga(),
createUserBusinessInfoSaga()
])
}
在info-component.js
componentDidMount(){
componentDidMount() {
this.props.dispatch({type: "CREATE_USER_BUSINESS_INFO_SAGA", data: {asdf : 444} });
}
}
错误
答案 0 :(得分:1)
我在javascript中误解了redux-saga中的<form:form action="reg.htm" modelAttribute="e">
Employee name: <form:input type="text" name="ename"path="ename"/>
Employee ID: <form:input type="text" name="empno"path="empno"/>
Employee job: <form:input type="text" name="job" path="job"/>
<input type="submit" value="success"/>
</form:form>
call
但是它不是
和
对于redux-saga,我们必须像这样导入它
call