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,8 +30,14 @@ 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 { data : contributor } = await axios ( `https://api.github.com/repos/devsonket/devsonket.github.io/commits?path=data/${ id } .json` ) ;
34- contributor = contributorMap ( contributor ) ;
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 ) {
37+ contributor = null ;
38+ } else {
39+ contributor = contributorMap ( contributor ) ;
40+ }
3541 this . setState ( { data, contributor} ) ;
3642 this . setTitle ( ) ;
3743 } catch ( e ) {
Original file line number Diff line number Diff line change @@ -14,7 +14,7 @@ export default class HeaderContent extends PureComponent {
1414 < div className = "intro" >
1515 < h1 > { title } </ h1 >
1616 < p > { description } </ p >
17- < ul className = "contributor no-print" >
17+ { contributor && < ul className = "contributor no-print" >
1818 < p > কন্ট্রিবিউটর</ p >
1919 { Object . keys ( contributor ) . map ( oneContributor => (
2020 < li key = { oneContributor } >
@@ -24,7 +24,7 @@ export default class HeaderContent extends PureComponent {
2424 </ div >
2525 </ li >
2626 ) ) }
27- </ ul >
27+ </ ul > }
2828 < div className = "print no-print" >
2929 < button className = "btn btn-print" onClick = { ( ) => window . print ( ) } > প্রিন্ট করুন</ button >
3030 </ div >
You can’t perform that action at this time.
0 commit comments