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.
Source: stackoverflow.com
Related Query
- Chat Engine API Support Chat via React
- Express does not receive parameters via POST from React using Fetch API
- React Chat Engine Loading
- API call after reloading same route via react router
- How Do I Deploy Flask API & React Frontend Microservices to Google App Engine with Proxy?
- How to fetch api via looped callbacks with React functional components
- Unhandled Rejection (Error) (HttpError) when connecting to SignalR hub in Ocelot Api Gateway via React Client Application
- Searching for Webpack config for React Components Library with Typescript, SASS & CSS Modules via SASS support
- How to allow customization of a React component's style via props, when withStyles api is used?
- React Flux Loading Initial Data via API Call
- Looping through post categories via WordPress REST API - React
- while building infinite loading via API in REACT , the page number is not updating in console even when i scroll down a lot
- Calling API via redux in react app does not work
- React - Changing multiple, individual components via one other component with Context API
- Showing errors returned via API - React Final Form
- React Hooks - Concatenate 2 text inputs to 1 to fetch data via API
- React update list after change via API
- Form reset issue after get response via API in react js
- How to get the right API information via JSON using React and Axios
- How to submit post/put request to Django rest API via React front end?
- Fetching a data text from API response and presenting it in a chat with React
- How to mapping restful api in react app via bootstrap
- Where do I attach the Execute API policy for React App deployed via ECR -> ECS -> ELB?
- Call an API method via React Redux on Browser close using 'beforeunload' event listener
- How do i make a GET requests from Imgur's API via Axios on my react app
- How to add a multilingual support in react js with api call?
- Sending xls via API with Java apache poi and React
- Dynamically populate Select options via API call in React Final Form
- React clean up function when setting context via hook api
- what is right way to do API call in react js?
More Query from same tag
- Creating routes inside a private route with react-router v6
- React: Getting index of mapped items outside component
- Save to localStorage from reducer hook
- React Native - Tab Navigator issue
- It is possible to mix chakraUi with tailwind?
- Cant render the array values using .map()
- Unit test i18Next - TypeError: Cannot read property 'init' of undefined
- How can I execute terminal script/command in Google Compute Instance remotely from my React app?
- The links do not render the components of ReactJS. The URL changes but the page does not?
- React TS - Type '() => Promise<void>' is not assignable to type 'EventHandler<ClickEvent, boolean | void>'
- How can I solve web vital error when I try yarn start?
- package.json not found when moving from Dockerfile to docker-compose
- TypeScript: What type do I set a value that is to be compared with a list of types?
- TypeError: Cannot read property 'map' of undefined When trying to map multiple arrays
- moment js 2 dates difference showing as NaN
- Trigger getSignedUrl function in node back, pass to front
- How to set username and password in axios get method header
- Pass state via Link while redirected to a new tab
- React Application Requiring Access to 3000+ Entries from Contentful API
- colour one row of antd table based on condition
- Object literal's property 'charts' implicitly has an 'any[]' type in react
- Creating a clear function for budgeting app
- react-lifecycle-component have props in componentDidMount
- Reactjs How would I display a simple error if no data is fetched from api?
- Passing a list form the front-end (react) to the back-end (django)
- Redux: Modifying state in Reducers, is it acceptable?
- React js set array of data in date picker
- Passing props to child's child React JS
- Fetching array of objects from api and storing to usestate but getting empty array
- converting from blob to binary to save it to mongodb