Hello, I use React and Redux with meteor, I have a problem I cannot do then, react side
for example for the register page I do this:, “the registration is going well”
// page register
const registerUser = (values) => {
return register(values)
.then((res) => console.log('res', res))
.catch((err) => {
setError(err);
});
};
redux part
export const register = (data) => (dispatch) => {
return Accounts.createUser(data, function (error, result) {
if (error) {
dispatch({
type: REGISTER_FAIL,
payload: error.reason,
});
return error;
} else {
dispatch({
type: REGISTER_SUCCESS,
});
return result;
}
});
};
I come across this error:
RegisterPage.jsx:22 Uncaught TypeError: Cannot read property 'then' of undefined