1
- import React , { Component } from " react" ;
2
- import axios from " axios" ;
3
- import FadeIn from " react-fade-in" ;
4
- import { withStyles } from " @material-ui/styles" ;
5
- import { faExternalLinkAlt } from " @fortawesome/free-solid-svg-icons" ;
6
- import { FontAwesomeIcon } from " @fortawesome/react-fontawesome" ;
1
+ import React , { Component } from ' react' ;
2
+ import axios from ' axios' ;
3
+ import FadeIn from ' react-fade-in' ;
4
+ import { withStyles } from ' @material-ui/styles' ;
5
+ import { faExternalLinkAlt } from ' @fortawesome/free-solid-svg-icons' ;
6
+ import { FontAwesomeIcon } from ' @fortawesome/react-fontawesome' ;
7
7
8
- import Form from " ./Form" ;
9
- import Placeholder from " ./Placeholder" ;
8
+ import Form from ' ./Form' ;
9
+ import Placeholder from ' ./Placeholder' ;
10
10
11
- import styles from " ../styles/HelpStyles" ;
11
+ import styles from ' ../styles/HelpStyles' ;
12
12
13
13
class Help extends Component {
14
14
constructor ( props ) {
15
15
super ( props ) ;
16
16
this . state = {
17
- query : "" ,
17
+ query : '' ,
18
18
data : { } ,
19
19
currentResources : [ ] ,
20
20
loadingStatus : null ,
@@ -31,21 +31,21 @@ class Help extends Component {
31
31
async fetchResources ( ) {
32
32
try {
33
33
const [ response ] = await Promise . all ( [
34
- axios . get ( " https://api .covid19india.org/resources/resources.json" ) ,
34
+ axios . get ( ' https://data .covid19india.org/resources/resources.json' ) ,
35
35
] ) ;
36
36
const hashmap = { } ;
37
37
response . data . resources . forEach ( ( x ) => {
38
- if ( typeof hashmap [ x [ " state" ] ] === " undefined" )
39
- hashmap [ x [ " state" ] ] = { } ;
40
- if ( typeof hashmap [ x [ " state" ] ] [ x [ " city" ] ] === " undefined" )
41
- hashmap [ x [ " state" ] ] [ x [ " city" ] ] = { } ;
38
+ if ( typeof hashmap [ x [ ' state' ] ] === ' undefined' )
39
+ hashmap [ x [ ' state' ] ] = { } ;
40
+ if ( typeof hashmap [ x [ ' state' ] ] [ x [ ' city' ] ] === ' undefined' )
41
+ hashmap [ x [ ' state' ] ] [ x [ ' city' ] ] = { } ;
42
42
43
43
if (
44
- typeof hashmap [ x [ " state" ] ] [ x [ " city" ] ] [ x [ " category" ] ] === " undefined"
44
+ typeof hashmap [ x [ ' state' ] ] [ x [ ' city' ] ] [ x [ ' category' ] ] === ' undefined'
45
45
)
46
- hashmap [ x [ " state" ] ] [ x [ " city" ] ] [ x [ " category" ] ] = [ ] ;
47
- if ( Array . isArray ( hashmap [ x [ " state" ] ] [ x [ " city" ] ] [ x [ " category" ] ] ) )
48
- hashmap [ x [ " state" ] ] [ x [ " city" ] ] [ x [ " category" ] ] . push ( x ) ;
46
+ hashmap [ x [ ' state' ] ] [ x [ ' city' ] ] [ x [ ' category' ] ] = [ ] ;
47
+ if ( Array . isArray ( hashmap [ x [ ' state' ] ] [ x [ ' city' ] ] [ x [ ' category' ] ] ) )
48
+ hashmap [ x [ ' state' ] ] [ x [ ' city' ] ] [ x [ ' category' ] ] . push ( x ) ;
49
49
} ) ;
50
50
this . setState ( { data : hashmap } ) ;
51
51
} catch ( err ) { }
@@ -56,7 +56,7 @@ class Help extends Component {
56
56
}
57
57
58
58
handleLoading ( ) {
59
- this . setState ( { loadingStatus : " loading" } ) ;
59
+ this . setState ( { loadingStatus : ' loading' } ) ;
60
60
}
61
61
62
62
getData ( ) {
@@ -73,7 +73,7 @@ class Help extends Component {
73
73
}
74
74
}
75
75
this . setState ( { currentResources : resources } ) ;
76
- setTimeout ( ( ) => this . setState ( { loadingStatus : " completeLoading" } ) , 2000 ) ;
76
+ setTimeout ( ( ) => this . setState ( { loadingStatus : ' completeLoading' } ) , 2000 ) ;
77
77
}
78
78
79
79
render ( ) {
@@ -128,14 +128,14 @@ class Help extends Component {
128
128
handleQuery = { this . handleQuery }
129
129
handleLoading = { this . handleLoading }
130
130
/>
131
- { this . state . loadingStatus === " loading" && (
131
+ { this . state . loadingStatus === ' loading' && (
132
132
< div className = { classes . container } >
133
133
< Placeholder />
134
134
< Placeholder />
135
135
< Placeholder />
136
136
</ div >
137
137
) }
138
- { this . state . loadingStatus === " completeLoading" && (
138
+ { this . state . loadingStatus === ' completeLoading' && (
139
139
< div className = { classes . container } > { res } </ div >
140
140
) }
141
141
</ div >
0 commit comments