Skip to content

Commit

Permalink
tried querystring-ing
Browse files Browse the repository at this point in the history
  • Loading branch information
Logan Leopold committed Jan 18, 2021
1 parent 3d20570 commit 1be8403
Showing 1 changed file with 23 additions and 1 deletion.
24 changes: 23 additions & 1 deletion src/FlightForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,20 +63,42 @@ class FlightForm extends Component {
outboundDate: today
})

let postData = querystring.stringify({
grant_type: "client_credentials",
client_id: `${process.env.REACT_APP_AMADEUS_KEY}`,
client_secret: `${process.env.REACT_APP_AMADEUS_SECRET}`
});

axios({
method: 'POST',
url: 'https://test.api.amadeus.com/v1/security/oauth2/token/',
headers: {
"content-type":"application/x-www-form-urlencoded",
},
data: `grant_type=client_credentials&client_id=${process.env.REACT_APP_AMADEUS_KEY}&client_secret=${process.env.REACT_APP_AMADEUS_SECRET}`,
data: postData
})
.then( function(response) {
console.log(response)
})

}

// componentDidUpdate() {

// axios({
// method: 'post',
// url: 'https://test.api.amadeus.com/v1/security/oauth2/token/',
// headers: {
// "Content-Type":"application/x-www-form-urlencoded",
// },
// data: `grant_type=client_credentials&client_id=${process.env.REACT_APP_AMADEUS_KEY}&client_secret=${process.env.REACT_APP_AMADEUS_SECRET}`,
// })
// .then( function(response) {
// console.log(response)
// })

// }

handleClick(event) {
event.preventDefault()

Expand Down

0 comments on commit 1be8403

Please sign in to comment.