Redux-saga - TypeError:无法读取未定义的属性'call'

时间:2016-12-15 17:10:46

标签: reactjs redux-saga

我关注saga,但收到TypeError: Cannot read property 'call' of undefined错误。

saga.js

import { call, put } from 'redux-saga/effects'
import LoginActions from '../Redux/LoginRedux'
import AuthAPI from '../Services/Auth'

// attempts to login
export function * login ({ email, password, save }) {
    try {
        const user = yield call(AuthAPI.login, {user: {email, password }})
        // dispatch successful logins
        yield put(LoginActions.loginSuccess(user.data))
    } catch(e) {
        yield put(LoginActions.loginFailure(e))
    }
}

Services/Auth.js

import request from 'superagent'

export default class AuthAPI {
    static login (data) {
        return request.post('/sessions.json').send(data)
    }
}

感谢任何帮助

0 个答案:

没有答案