score:0

in your createuser you are setting username to email. you'll need to pass the name in if you want to set username to it.

  const handlesubmit = () => {
    createuser(email, username,
      user => {
        createchat(email,
          chat => console.log('success', chat)
        )
      }
    )
  };

then in your createuser:

const createuser = (email, username, callback) => {
  axios
    .put(
      "https://api.chatengine.io/users/",
      {
        "username": username,
        "secret": email,
        "email": email,
      },
      { headers: { "private-key": process.env.react_app_ce_private_key } }
    )
    .then((r) => callback(r.data))
    .catch(error => {
        console.error('there was an error', error)
    })
};

also, you are setting secret to email.


Related Query

More Query from same tag