redux-saga' call'没有定义no-undef

时间:2017-07-18 04:05:36

标签: reactjs redux redux-saga

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} });
    }
}

错误

Error

1 个答案:

答案 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