Merge pull request #16720 from fccSeniorSeminar/fix/invalid-challenge-URL

Fix/invalid challenge url
This commit is contained in:
Berkeley Martinez
2018-03-06 10:15:58 -08:00
committed by GitHub
4 changed files with 18 additions and 5 deletions

View File

@ -1,15 +1,22 @@
import React from 'react';
// import PropTypes from 'prop-types';
import { Alert } from 'react-bootstrap';
const propTypes = {};
export default function NotFound() {
return (
<div>404 Not Found</div>
<Alert bsStyle='danger'>
<h4>Oh snap! Page not found!</h4>
<p>
Head back to
</p>
<a href='/challenges/current-challenge'>
your current challenge
</a>
</Alert>
);
}
NotFound.displayName = 'NotFound';
NotFound.propTypes = propTypes;

View File

@ -11,6 +11,7 @@ import Project from './views/project';
import BackEnd from './views/backend';
import Quiz from './views/quiz';
import Modern from './views/Modern';
import NotFound from '../../NotFound';
import { fullBlocksSelector } from '../../entities';
import {
@ -29,7 +30,8 @@ const views = {
project: Project,
quiz: Quiz,
simple: Project,
step: Step
step: Step,
invalid: NotFound
};
const mapDispatchToProps = {

View File

@ -223,7 +223,10 @@ export const challengeMetaSelector = createSelector(
(...args) => challengeSelector(...args),
challenge => {
if (!challenge.id) {
return {};
const viewType = 'invalid';
return {
viewType
};
}
const challengeType = challenge && challenge.challengeType;
const type = challenge && challenge.type;

View File

@ -10,3 +10,4 @@ export const bonfire = 5;
export const video = 6;
export const step = 7;
export const quiz = 8;
export const invalid = 9;