File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -30,13 +30,12 @@ class Content extends Component {
3030 getData = async ( id ) => {
3131 try {
3232 const { data } = await axios ( `https://raw.githubusercontent.com/devsonket/devsonket.github.io/develop/data/${ id } .json` ) ;
33- let contributorRaw = await axios ( `https://api.github.com/repos/devsonket/devsonket.github.io/commits?path=data/${ id } .json` ) ;
34- console . log ( contributorRaw ) ; // kept this to check the behaviour as I can't recreate the scenario
35- let { data : contributor } = contributorRaw ;
36- if ( contributorRaw . status !== 200 ) {
33+ let contributor ;
34+ try {
35+ let { data } = await axios ( `https://api.github.com/repos/devsonket/devsonket.github.io/commits?path=data/${ id } .json` ) ;
36+ contributor = contributorMap ( data ) ;
37+ } catch ( e ) {
3738 contributor = null ;
38- } else {
39- contributor = contributorMap ( contributor ) ;
4039 }
4140 this . setState ( { data, contributor} ) ;
4241 this . setTitle ( ) ;
You can’t perform that action at this time.
0 commit comments