gpt4 book ai didi

javascript - Uncaught Error : Actions must be plain objects?

转载 作者:行者123 更新时间:2023-11-28 14:57:19 26 4
gpt4 key购买 nike

Uncaught Error: Actions must be plain objects. Use custom middleware for async actions.....

操作文件:

import $ from 'jquery'

import { phoneVerify } from '../actions/types'

const verifyPhoneAsync = function (verification) {
return {
type: phoneVerify,
payload: verification
}
}
const verifyPhone = function (phone) {
$.ajax({
url: 'api',
type: 'POST',
data: { mobile: phone },
dataType: 'json',
success: (data) => {
console.log(data)
}
})
}
const verifyOtp = function (phone, otp) {
return (dispatch) => {
$.ajax({
url: 'api',
type: 'POST',
data: { mobile: phone, code: otp, devicetoken: 'nil', devicetype: 'nil' },
dataType: 'json',
success: (data) => {
if (data.success === true) {
localStorage.setItem('MobileNumber', phone)
const varification = data
dispatch(verifyPhoneAsync(varification))
} else {
console.log('rfg')
const varification = data
dispatch(verifyPhoneAsync(varification))
}
}
})
}
}
export { verifyPhone, verifyOtp }

最佳答案

您忘记了 verifyPhone 操作中的返回,因此出现此错误。

关于javascript - Uncaught Error : Actions must be plain objects?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42346248/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com