From 975dccebfcf51878b790a765d8e92ebcad895a24 Mon Sep 17 00:00:00 2001 From: Kamal Wickramanayake Date: Sat, 4 Jul 2026 06:42:12 +0530 Subject: Microservice react-app - posts hidden for anonymous users --- microservices/04-react-app/src/App.jsx | 4 ++-- microservices/04-react-app/src/components/Navbar.jsx | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) (limited to 'microservices/04-react-app') diff --git a/microservices/04-react-app/src/App.jsx b/microservices/04-react-app/src/App.jsx index aedd87e..956e60a 100644 --- a/microservices/04-react-app/src/App.jsx +++ b/microservices/04-react-app/src/App.jsx @@ -11,7 +11,7 @@ import AdminPage from "./pages/AdminPage"; import { useAuth } from "./contexts/AuthContext"; function App() { - const { isAdmin } = useAuth(); + const { isLoggedIn, isAdmin } = useAuth(); return (
@@ -20,7 +20,7 @@ function App() { } /> } /> - } /> + : } /> : } /> diff --git a/microservices/04-react-app/src/components/Navbar.jsx b/microservices/04-react-app/src/components/Navbar.jsx index 9697c73..bc79138 100644 --- a/microservices/04-react-app/src/components/Navbar.jsx +++ b/microservices/04-react-app/src/components/Navbar.jsx @@ -29,11 +29,14 @@ const Navbar = () => { About + + {isLoggedIn() && (
  • Posts
  • + )}
  • -- cgit v1.2.3