Commit 3e0316f 1 parent 20cbcc0 commit 3e0316f Copy full SHA for 3e0316f
File tree 11 files changed +12850
-7
lines changed
11 files changed +12850
-7
lines changed Original file line number Diff line number Diff line change 17
17
.env.development.local
18
18
.env.test.local
19
19
.env.production.local
20
+ .env
20
21
21
22
npm-debug.log *
22
23
yarn-debug.log *
Original file line number Diff line number Diff line change 4
4
"private" : true ,
5
5
"dependencies" : {
6
6
"axios" : " ^0.18.0" ,
7
+ "dotenv" : " ^8.0.0" ,
7
8
"express" : " ^4.17.0" ,
8
9
"nodemon" : " ^1.19.0" ,
9
10
"path" : " ^0.12.7" ,
17
18
"test" : " react-scripts test" ,
18
19
"eject" : " react-scripts eject" ,
19
20
"server" : " nodemon server.js" ,
20
- "start" :" node server.js"
21
+ "start" : " node server.js"
21
22
},
22
23
"eslintConfig" : {
23
24
"extends" : " react-app"
Original file line number Diff line number Diff line change 10
10
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
11
11
-->
12
12
< link rel ="manifest " href ="%PUBLIC_URL%/manifest.json " />
13
+ < link rel ="stylesheet " href ="https://cdnjs.cloudflare.com/ajax/libs/animate.css/3.7.0/animate.min.css ">
14
+
13
15
<!--
14
16
Notice the use of %PUBLIC_URL% in the tags above.
15
17
It will be replaced with the URL of the `public` folder during the build.
Original file line number Diff line number Diff line change 7
7
height : 40vmin ;
8
8
pointer-events : none;
9
9
}
10
+ .App-logo-small {
11
+ animation : App-logo-spin infinite 20s linear;
12
+ height : 20vmin ;
13
+ pointer-events : none;
14
+ }
10
15
11
16
.App-header {
12
17
background-color : # 282c34 ;
Original file line number Diff line number Diff line change 1
1
import React from 'react' ;
2
2
import logo from './logo.svg' ;
3
3
import ChucksJoke from './ChucksJoke'
4
+ import Quote from './Quote'
5
+ import SkyScanner from './SkyScanner'
6
+ import Chuck from './assets/chuck.jpg'
4
7
import './App.css' ;
5
8
9
+
6
10
function App ( ) {
7
11
return (
8
12
< div className = "App" >
9
13
< header className = "App-header" >
10
14
< img src = { logo } className = "App-logo" alt = "logo" />
15
+ < Quote />
16
+ < img src = { Chuck } className = "animated fadeInLeftBig delay-2s" alt = "cuck" />
11
17
< ChucksJoke />
12
- < p >
13
- Edit < code > src/App.js</ code > and save to reload.
14
- </ p >
18
+ < img src = { logo } className = "App-logo-small" alt = "logo" />
19
+ < SkyScanner />
15
20
< a
16
21
className = "App-link"
17
22
href = "https://reactjs.org"
18
23
target = "_blank"
19
24
rel = "noopener noreferrer"
20
25
>
21
- Team Cobra gogogogogo !!!
26
+ Team Cobra - Saviours of the Universe !!!
22
27
</ a >
23
28
</ header >
24
29
</ div >
Original file line number Diff line number Diff line change 1
1
import React from "react" ;
2
+ require ( 'dotenv' ) . config ( )
2
3
3
- export default class ApiOne extends React . Component {
4
+
5
+ export default class ChucksJoke extends React . Component {
4
6
constructor ( ) {
5
7
super ( ) ;
6
8
this . state = {
@@ -16,7 +18,8 @@ export default class ApiOne extends React.Component {
16
18
) ;
17
19
myHeaders . append (
18
20
"X-RapidAPI-Key" ,
19
- "5456615b4cmsh40eaeb350692ccep17bbe1jsn2758aaa3f720"
21
+
22
+ process . env . REACT_APP_API_RAPID
20
23
) ;
21
24
myHeaders . append ( "accept" , "application/json" ) ;
22
25
Original file line number Diff line number Diff line change
1
+ import React from "react" ;
2
+ require ( 'dotenv' ) . config ( )
3
+ console . log ( process . env )
4
+
5
+
6
+ export default class Quote extends React . Component {
7
+ constructor ( ) {
8
+ super ( ) ;
9
+ this . state = {
10
+ quote : [ ]
11
+ } ;
12
+ }
13
+
14
+ componentDidMount ( ) {
15
+ const myHeadersOne = new Headers ( ) ;
16
+ myHeadersOne . append (
17
+ "X-RapidAPI-Host" , "andruxnet-random-famous-quotes.p.rapidapi.com"
18
+ ) ;
19
+ myHeadersOne . append (
20
+ "X-RapidAPI-Key" , process . env . REACT_APP_API_RAPID
21
+ ) ;
22
+
23
+ const myInit = { method : "GET" , headers : myHeadersOne } ;
24
+
25
+ const myRequestOne = new Request (
26
+ "https://andruxnet-random-famous-quotes.p.rapidapi.com/?cat=famous&count=1" ,
27
+ myInit
28
+ ) ;
29
+
30
+ fetch ( myRequestOne )
31
+ . then ( res => res . json ( ) )
32
+ . then ( data =>
33
+ this . setState ( {
34
+ quote : data [ 0 ] . quote
35
+ } )
36
+ ) ;
37
+ }
38
+
39
+ render ( ) {
40
+ return (
41
+ < div className = "container" >
42
+ < h2 > { this . state . quote } </ h2 >
43
+ </ div >
44
+ ) ;
45
+ }
46
+ }
Original file line number Diff line number Diff line change
1
+ import React from "react" ;
2
+ require ( 'dotenv' ) . config ( )
3
+
4
+
5
+ export default class SkyScanner extends React . Component {
6
+ constructor ( ) {
7
+ super ( ) ;
8
+ this . state = {
9
+ minPrice : [ ] ,
10
+ departure : '' ,
11
+ arrival : ''
12
+ } ;
13
+ }
14
+
15
+ componentDidMount ( ) {
16
+ const myHeadersOne = new Headers ( ) ;
17
+ myHeadersOne . append (
18
+ "X-RapidAPI-Host" , "skyscanner-skyscanner-flight-search-v1.p.rapidapi.com"
19
+ ) ;
20
+ myHeadersOne . append (
21
+ "X-RapidAPI-Key" , process . env . REACT_APP_API_RAPID
22
+ ) ;
23
+
24
+ const myInit = { method : "GET" , headers : myHeadersOne } ;
25
+
26
+ const myRequestOne = new Request (
27
+ "https://skyscanner-skyscanner-flight-search-v1.p.rapidapi.com/apiservices/browsequotes/v1.0/US/USD/en-US/SFO-sky/JFK-sky/2019-10-01?inboundpartialdate=2019-09-01" ,
28
+ myInit
29
+ ) ;
30
+
31
+ fetch ( myRequestOne )
32
+ . then ( res => res . json ( ) )
33
+ . then ( data =>
34
+ this . setState ( {
35
+ minPrice : data . Quotes [ 0 ] . MinPrice ,
36
+ departure : data . Places [ 0 ] . Name ,
37
+ arrival : data . Places [ 1 ] . Name
38
+ } )
39
+ ) ;
40
+
41
+ }
42
+
43
+ render ( ) {
44
+ return (
45
+ < div className = "container" >
46
+
47
+ < h2 > { this . state . departure } to { this . state . arrival } - £{ this . state . minPrice } </ h2 >
48
+ </ div >
49
+ ) ;
50
+ }
51
+ }
52
+
53
+
Original file line number Diff line number Diff line change @@ -3475,6 +3475,11 @@ dotenv@6.2.0:
3475
3475
resolved "https://registry.yarnpkg.com/dotenv/-/dotenv-6.2.0.tgz#941c0410535d942c8becf28d3f357dbd9d476064"
3476
3476
integrity sha512-HygQCKUBSFl8wKQZBSemMywRWcEDNidvNbjGVyZu3nbZ8qq9ubiPoGLMdRDpfSrpkkm9BXYFkpKxxFX38o/76w==
3477
3477
3478
+ dotenv@^8.0.0 :
3479
+ version "8.0.0"
3480
+ resolved "https://registry.yarnpkg.com/dotenv/-/dotenv-8.0.0.tgz#ed310c165b4e8a97bb745b0a9d99c31bda566440"
3481
+ integrity sha512-30xVGqjLjiUOArT4+M5q9sYdvuR4riM6yK9wMcas9Vbp6zZa+ocC9dp6QoftuhTPhFAiLK/0C5Ni2nou/Bk8lg==
3482
+
3478
3483
duplexer3@^0.1.4 :
3479
3484
version "0.1.4"
3480
3485
resolved "https://registry.yarnpkg.com/duplexer3/-/duplexer3-0.1.4.tgz#ee01dd1cac0ed3cbc7fdbea37dc0a8f1ce002ce2"
You can’t perform that action at this time.
0 commit comments