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' ;
77
8- import Form from " ./Form" ;
9- import Placeholder from " ./Placeholder" ;
8+ import Form from ' ./Form' ;
9+ import Placeholder from ' ./Placeholder' ;
1010
11- import styles from " ../styles/HelpStyles" ;
11+ import styles from ' ../styles/HelpStyles' ;
1212
1313class Help extends Component {
1414 constructor ( props ) {
1515 super ( props ) ;
1616 this . state = {
17- query : "" ,
17+ query : '' ,
1818 data : { } ,
1919 currentResources : [ ] ,
2020 loadingStatus : null ,
@@ -31,21 +31,21 @@ class Help extends Component {
3131 async fetchResources ( ) {
3232 try {
3333 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' ) ,
3535 ] ) ;
3636 const hashmap = { } ;
3737 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' ] ] = { } ;
4242
4343 if (
44- typeof hashmap [ x [ " state" ] ] [ x [ " city" ] ] [ x [ " category" ] ] === " undefined"
44+ typeof hashmap [ x [ ' state' ] ] [ x [ ' city' ] ] [ x [ ' category' ] ] === ' undefined'
4545 )
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 ) ;
4949 } ) ;
5050 this . setState ( { data : hashmap } ) ;
5151 } catch ( err ) { }
@@ -56,7 +56,7 @@ class Help extends Component {
5656 }
5757
5858 handleLoading ( ) {
59- this . setState ( { loadingStatus : " loading" } ) ;
59+ this . setState ( { loadingStatus : ' loading' } ) ;
6060 }
6161
6262 getData ( ) {
@@ -73,7 +73,7 @@ class Help extends Component {
7373 }
7474 }
7575 this . setState ( { currentResources : resources } ) ;
76- setTimeout ( ( ) => this . setState ( { loadingStatus : " completeLoading" } ) , 2000 ) ;
76+ setTimeout ( ( ) => this . setState ( { loadingStatus : ' completeLoading' } ) , 2000 ) ;
7777 }
7878
7979 render ( ) {
@@ -128,14 +128,14 @@ class Help extends Component {
128128 handleQuery = { this . handleQuery }
129129 handleLoading = { this . handleLoading }
130130 />
131- { this . state . loadingStatus === " loading" && (
131+ { this . state . loadingStatus === ' loading' && (
132132 < div className = { classes . container } >
133133 < Placeholder />
134134 < Placeholder />
135135 < Placeholder />
136136 </ div >
137137 ) }
138- { this . state . loadingStatus === " completeLoading" && (
138+ { this . state . loadingStatus === ' completeLoading' && (
139139 < div className = { classes . container } > { res } </ div >
140140 ) }
141141 </ div >
0 commit comments