我关注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)
}
}
感谢任何帮助