Javascript 如何使用“;。然后();用这个。道具
我有一个句柄提交功能,当我们点击按钮时,API更新表单就会出现。在此期间显示API a加载程序的等待时间。但是当我尝试这段代码时,出现了一个错误 TypeError:“\u this.props.setDeviceInfo(…).then”不是函数 以下是Handlesubmit函数:Javascript 如何使用“;。然后();用这个。道具,javascript,reactjs,react-redux,Javascript,Reactjs,React Redux,我有一个句柄提交功能,当我们点击按钮时,API更新表单就会出现。在此期间显示API a加载程序的等待时间。但是当我尝试这段代码时,出现了一个错误 TypeError:“\u this.props.setDeviceInfo(…).then”不是函数 以下是Handlesubmit函数: handleSubmit = (e) => { e.preventDefault(); this.props.form.validateFieldsAndScroll((err, values)
handleSubmit = (e) => {
e.preventDefault();
this.props.form.validateFieldsAndScroll((err, values) => {
if (!err) {
this.props.setDevicEtherConfigAction(values).then(() => {
this.props.showLoaderAction();
});
}
});
}
//********************* Action**************************//
export const setDeviceInfoAction = (values) => {
return {
type: SET_DEVICE_INFO,
payload: {
values
}
};
};
//********************* Sagas**************************//
function* setDeviceInfo({ payload }) {
try {
const data = yield call(setDeviceInfoRequest, payload.values);
if (data === 200) {
yield put(showAlertAction(...........................));
} else {
yield put(showAlertAction(...........................));
}
} catch (error) {}
}
export function* setDeviceInfoFork() {
yield takeEvery(SET_DEVICE_INFO, setDeviceInfo);
}
//***********************Service*******************************//
export const setDeviceInfoRequest = async (payload) => {
let request = ..........................
var AuthToken = .........................
return new Promise(function (resolve, reject) {
client........(request, {'x-authorization': AuthToken}, (err, response) => {
var status = 200
if (response === null) {
resolve(false);
} else {
resolve(status);
}
});
})
}
您能否显示父组件(如何传递道具)和
setDeviceTheConfigAction
的代码您能否显示父组件(如何传递道具)和setDeviceTheConfigAction