From fb78791be7c54bb7a7a6acb2c8322fbc60dbfccd Mon Sep 17 00:00:00 2001 From: Ahmed Al-Taiar Date: Wed, 22 Nov 2023 11:58:57 -0500 Subject: [PATCH] Hide transactions button if not logged in --- web/src/layouts/NavbarLayout/NavbarLayout.tsx | 42 +++++++++++-------- 1 file changed, 25 insertions(+), 17 deletions(-) diff --git a/web/src/layouts/NavbarLayout/NavbarLayout.tsx b/web/src/layouts/NavbarLayout/NavbarLayout.tsx index a2c8a03..1d1f0a7 100644 --- a/web/src/layouts/NavbarLayout/NavbarLayout.tsx +++ b/web/src/layouts/NavbarLayout/NavbarLayout.tsx @@ -17,7 +17,7 @@ type NavBarLayoutProps = { } const NavBarLayout = ({ children }: NavBarLayoutProps) => { - const { hasRole } = useAuth() + const { hasRole, isAuthenticated } = useAuth() const [basket] = useState(getBasket()) return ( @@ -40,14 +40,18 @@ const NavBarLayout = ({ children }: NavBarLayoutProps) => {
{

Basket

-
  • - -

    Transactions

    - -
  • + {isAuthenticated ? ( +
  • + +

    Transactions

    + +
  • + ) : ( + <> + )}