How to use unirest in React

Hi All,
I have simple question to do translate to use unirest in React app ? consider having something like the following:
unirest

.get('https://api.onegov.nsw.gov.au/oauth/client_credential/accesstoken')

.headers({'Accept': 'application/json', 'authorization': Authorization})

.query({"grant_type": "client_credentials"})

.end((response) => {     

   if(response.error) {

     console.log('Something went wrong!!')

   } 

     const data = response.body["access_token"]

     callback(returnData(data)) ;  

})

How do I use that in React format ?

I apologize this is not a forum for programming but sometimes the people who created the framework are the best source of info to explain.

Thank you


© 2019 Kong Inc.    Terms  •  Privacy  •  FAQ