Closed BradPrit09 closed 4 years ago
export const registerDevice = (userData, history) => dispatch => { axios .post("/api/users/addDevice/${user_id}", userData) .then(res => history.push("/Comment")) .catch(err => dispatch({ type: GET_ERRORS, payload: err.response.data }) ); };
The user_id
variable seems undefined. Where is it coming from? Is it part of the userData
object? If so, would have to say userData.user_id
.
Would add a console.log
in your action to make sure it is being fired off, and see what it included in the userData
parameter. Hope that is helpful.
Closing this issue as there seem to be no follow-ups. Hope you were able to figure it out!
@rishipr I need help . Please have a look . I mapped the mapStateToProps like this .
from my component and when i do axios request in authAction , Do I need to pass directly user directly like
My back-end code is developed such that it takes farm id also,I can make a postman request it's working but I am unable to integrate with front-end part ,little.
Originally posted by @BradPrit09 in https://github.com/rishipr/mern-auth/issues/15#issuecomment-559104344