redirect to notfound page if dev is null

This commit is contained in:
Ruidy Nemausat 2020-05-17 12:31:29 +02:00
parent 341e7e7054
commit ae0360f6bb

View file

@ -1,4 +1,4 @@
import React, {FC} from 'react'; import React, {FC, useState, useEffect} from 'react';
import {FontAwesomeIcon} from '@fortawesome/react-fontawesome'; import {FontAwesomeIcon} from '@fortawesome/react-fontawesome';
import { import {
faGithub, faGithub,
@ -25,7 +25,8 @@ import {firestoreConnect} from 'react-redux-firebase';
import {connect} from 'react-redux'; import {connect} from 'react-redux';
import {RootState} from '../store'; import {RootState} from '../store';
import Routes from '../constants/routes'; import Routes from '../constants/routes';
import {Link, useParams} from 'react-router-dom'; import {Link, useParams, Redirect} from 'react-router-dom';
import NotFound from './NotFound';
interface IProps { interface IProps {
dev: Dev; dev: Dev;
@ -35,6 +36,11 @@ interface IProps {
* Dev personal profile as seen by other people. * Dev personal profile as seen by other people.
*/ */
const Profile: FC<IProps> = ({dev}) => { const Profile: FC<IProps> = ({dev}) => {
// display 404 page if dev is null
if (dev === null) {
return <NotFound />;
}
/** return the icon corresponding to the social name */ /** return the icon corresponding to the social name */
const renderSocialIcon = (name: string): IconDefinition => { const renderSocialIcon = (name: string): IconDefinition => {
switch (name) { switch (name) {