Skip to content

Commit

Permalink
commented out SDK and reverted to url params
Browse files Browse the repository at this point in the history
  • Loading branch information
Logan Leopold committed Jan 23, 2021
1 parent b331155 commit 90f5c83
Showing 1 changed file with 22 additions and 26 deletions.
48 changes: 22 additions & 26 deletions src/FlightForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -168,34 +168,30 @@ class FlightForm extends Component {
// For normal text input
handleInput(event) {

// axios({
// method: 'get',
// url: 'https://test.api.amadeus.com/v1/reference-data/locations',
// headers: {
// "Content-Type":"application/x-www-form-urlencoded",
// "Authorization": `Bearer ${this.state.oAuth}`
// },
// data: body
// }).then( function(response) {
// let token = response.data.access_token
// form.setState({
// oAuth: token
// })
// }).catch( err => console.log(err))
axios({
method: 'get',
url: `https://test.api.amadeus.com/v1/reference-data/locations?subType=AIRPORT%2CCITY&keyword=${event.target.value}`,
headers: {
"Content-Type":"application/x-www-form-urlencoded",
"Authorization": `Bearer ${this.state.oAuth}`
}
}).then( function(response) {
console.log(response.data.data)
}).catch( err => console.log(err))

var amadeus = new Amadeus ({
clientId: process.env.REACT_APP_AMADEUS_KEY,
clientSecret: process.env.REACT_APP_AMADEUS_SECRET
})
// var amadeus = new Amadeus ({
// clientId: process.env.REACT_APP_AMADEUS_KEY,
// clientSecret: process.env.REACT_APP_AMADEUS_SECRET
// })

amadeus.referenceData.locations.get({
keyword : `${event.target.value}`,
subType : Amadeus.location.any
}).then( function (response) {
console.log(response.data)
}).catch( function (err) {
console.log(err.data)
})
// amadeus.referenceData.locations.get({
// keyword : `${event.target.value}`,
// subType : Amadeus.location.any
// }).then( function (response) {
// console.log(response.data)
// }).catch( function (err) {
// console.log(err.data)
// })

this.setState({
[event.target.name]: event.target.value
Expand Down

0 comments on commit 90f5c83

Please sign in to comment.