I have 4 separate input send a request for update user data, So I make a function that takes an argument and passes it to body But it's not working I got 500 status error!
But when I declare the body name it's work for one input.
const sendReq = (bodyName) => {
    let AuthStr =
      'Bearer ...';
    const headers = {
      'Content-Type': 'application/json',
      Authorization: AuthStr,
    };
    Api.post(
      '/edit/user',
      {
        email: bodyName, // here it's work "but i want this be more dynimacly."
       // bodyName: bodyName, // error 500
      },
      {
        headers,
      },
    ).then((res) => {
      console.log(res.data);
    });
  };
// for update email
  const updateEmail = (newEmail) => {
    if (validateEmail(newEmail)) {
      setError('');
      sendReq(email);
      console.log('yay!');
    } else {
      setError('error....');
    }
  };
// password
const updatePassword = () => {
    ....
    sendReq(password);
}
// and so on...
 
    