From 90f5c8398e68726415b8b233acea8fa034d01d82 Mon Sep 17 00:00:00 2001 From: Logan Leopold Date: Fri, 22 Jan 2021 23:54:45 -0500 Subject: [PATCH] commented out SDK and reverted to url params --- src/FlightForm.js | 48 ++++++++++++++++++++++------------------------- 1 file changed, 22 insertions(+), 26 deletions(-) diff --git a/src/FlightForm.js b/src/FlightForm.js index 78778bf..acfcc61 100644 --- a/src/FlightForm.js +++ b/src/FlightForm.js @@ -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