From c988143921aff0aa27f5ddad715e08bee829fe7f Mon Sep 17 00:00:00 2001 From: Ruidy Nemausat Date: Sat, 16 May 2020 13:40:07 +0200 Subject: [PATCH] add isActive field to dev, checks for user existance on sign up to not overwrite inactive profiles --- src/components/NavBar.tsx | 8 +++++--- src/pages/SignIn.tsx | 7 ++++--- src/pages/SignUp.tsx | 28 +++++++++++++++++++++++----- src/router/PrivateRoute.tsx | 4 +++- src/store/firebase/config.ts | 2 +- src/store/index.ts | 6 ++---- 6 files changed, 38 insertions(+), 17 deletions(-) diff --git a/src/components/NavBar.tsx b/src/components/NavBar.tsx index 606b0ff..e2eddc5 100644 --- a/src/components/NavBar.tsx +++ b/src/components/NavBar.tsx @@ -10,8 +10,9 @@ import {FontAwesomeIcon} from '@fortawesome/react-fontawesome'; import {faCode, faSignOutAlt, faUser} from '@fortawesome/free-solid-svg-icons'; // Typing import User from '../models/User'; +import Dev from '../models/Dev'; -interface IProps extends WithFirebaseProps { +interface IProps extends Dev, WithFirebaseProps { isEmpty: boolean; isLoaded: boolean; } @@ -19,7 +20,7 @@ interface IProps extends WithFirebaseProps { /** * Main Navbar serves navigation Routes. */ -const NavBar: FC = ({firebase, isEmpty, isLoaded}) => { +const NavBar: FC = ({firebase, isEmpty, isLoaded, isActive}) => { const publicLinks = (
  • @@ -72,7 +73,8 @@ const NavBar: FC = ({firebase, isEmpty, isLoaded}) => { ); /** Display appropriated links after loading given authenticated prop */ - const RenderLinks = isLoaded && !isEmpty ? privateLinks : publicLinks; + const RenderLinks = + isLoaded && !isEmpty && isActive ? privateLinks : publicLinks; return (