当我使用诺言从API END点获取价值时,我遇到了此类问题。
export function* signUpWithEmail(authInfo: any) {
const { email, password } = authInfo.payload
try {
const response = yield authSignUpService
.register(email, password)
.then((res) => console.log(res))
yield put(signUpSuccess(response))
} catch (error) {
yield put(signUpFailure({ msg: error.message }))
}
}
答案 0 :(得分:1)
authSignUpService
.register(email, password)
不是Promise
类型的。因此,您无法使用then()
函数。