@@ -24,6 +24,7 @@ import challengeActions from 'actions/challenge';
24
24
import termsActions from 'actions/terms' ;
25
25
import config from 'utils/config' ;
26
26
import { BUCKETS } from 'utils/challenge-listing/buckets' ;
27
+ import Error404 from 'components/Error404' ;
27
28
28
29
import './styles.scss' ;
29
30
@@ -126,6 +127,9 @@ class ChallengeDetailPageContainer extends React.Component {
126
127
127
128
if ( this . props . isLoadingChallenge ) return < LoadingPagePlaceholder /> ;
128
129
130
+ if ( this . props . fetchChallengeFailure &&
131
+ this . props . fetchChallengeFailure . errorCode === 404 ) return < Error404 /> ;
132
+
129
133
return (
130
134
< div styleName = "outer-container" >
131
135
< div styleName = "challenge-detail-container" >
@@ -231,6 +235,7 @@ class ChallengeDetailPageContainer extends React.Component {
231
235
ChallengeDetailPageContainer . defaultProps = {
232
236
tokenV3 : null ,
233
237
isLoadingChallenge : false ,
238
+ fetchChallengeFailure : null ,
234
239
loadingCheckpointResults : false ,
235
240
checkpointResults : null ,
236
241
loadingResults : false ,
@@ -251,6 +256,7 @@ ChallengeDetailPageContainer.propTypes = {
251
256
tokenV3 : PT . string ,
252
257
challenge : PT . shape ( ) . isRequired ,
253
258
isLoadingChallenge : PT . bool ,
259
+ fetchChallengeFailure : PT . shape ( ) ,
254
260
loadChallengeDetails : PT . func . isRequired ,
255
261
authTokens : PT . shape ( ) . isRequired ,
256
262
challengeId : PT . number . isRequired ,
@@ -369,6 +375,7 @@ const mapStateToProps = (state, props) => ({
369
375
state . challenge . detailsV2 ,
370
376
Number ( props . match . params . challengeId ) ) ,
371
377
isLoadingChallenge : Boolean ( state . challenge . loadingDetailsForChallengeId ) ,
378
+ fetchChallengeFailure : state . challenge . fetchChallengeFailure ,
372
379
authTokens : state . auth ,
373
380
tokenV2 : state . auth && state . auth . tokenV2 ,
374
381
tokenV3 : state . auth && state . auth . tokenV3 ,
@@ -398,7 +405,7 @@ const mapDispatchToProps = (dispatch) => {
398
405
dispatch ( a . getDetailsInit ( challengeId ) ) ;
399
406
dispatch ( a . getDetailsDone ( challengeId , tokens . tokenV3 , tokens . tokenV2 ) )
400
407
. then ( ( res ) => {
401
- if ( res . payload [ 0 ] . track === 'DESIGN' ) {
408
+ if ( res . payload [ 0 ] && res . payload [ 0 ] . track === 'DESIGN' ) {
402
409
dispatch ( a . fetchCheckpointsInit ( ) ) ;
403
410
dispatch ( a . fetchCheckpointsDone ( tokens . tokenV2 , challengeId ) ) ;
404
411
}
0 commit comments