mirror of
https://github.com/rjNemo/devbook_ts
synced 2026-06-11 21:16:45 +00:00
redirect to notfound page if dev is null
This commit is contained in:
parent
341e7e7054
commit
ae0360f6bb
1 changed files with 8 additions and 2 deletions
|
|
@ -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) {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue