Incorrect Integer value: ‘undefined’ for column ‘user_id’

As per the console log this.props.user[0].id is a number. You shouldn’t destructure it, instead, you can directly assign it to a variable and use it.

As you are destructuring, the user_id is going as undefined that is causing the issue.

const { user_id } = this.props.user[0].id;  This should be change to

const user_id = this.props.user[0].id;

Pass the params like below:-

axios.post("http://localhost:7001/api/profile/share", {
              user_id,
              body,
              createdAt,
              updatedAt
          }) 

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top