diff --git a/src/App.js b/src/App.js
index f6b7715..45ff38c 100644
--- a/src/App.js
+++ b/src/App.js
@@ -6,10 +6,14 @@ import Login from './components/Login';
import Boxes from './components/Boxes';
import Items from './components/Items';
import Navbar from './components/Navbar'; // Correct import here
+import { createContext } from 'react';
import './styles.css'
+export const AppContext = createContext();
+
function App() {
const [token, setToken] = useState(localStorage.getItem('token'));
+
useEffect(() => {
if (token) {
localStorage.setItem('token', token);
@@ -17,9 +21,12 @@ function App() {
}, [token]);
return (
-
-
-
+
+
+
+
+
+
);
}
@@ -28,7 +35,6 @@ function AppRoutes({ token, setToken }) {
return (
<>
-
} />
{
+ localStorage.removeItem('token');
+ setToken(null);
+ navigate('/login');
+ };
+
return (
@@ -13,6 +31,7 @@ export default function Navbar() {
+
);