mirror of
https://github.com/escalante29/healthy-fit.git
synced 2026-03-21 15:08:46 +01:00
Initial project scaffolding for health tracker app
Set up backend and frontend structure for a health and fitness tracker using Python (FastAPI, SQLModel, DSPy) and React. Includes Docker and Compose configs, authentication, nutrition AI module, health/nutrition/user endpoints, database models, and basic frontend with routing and context. Enables tracking nutrition, health metrics, and user management, with architecture ready for future mobile and cloud deployment.
This commit is contained in:
13
frontend/src/components/ProtectedRoute.jsx
Normal file
13
frontend/src/components/ProtectedRoute.jsx
Normal file
@@ -0,0 +1,13 @@
|
||||
import { useContext } from 'react';
|
||||
import { Navigate } from 'react-router-dom';
|
||||
import { AuthContext } from '../context/AuthContext';
|
||||
|
||||
const ProtectedRoute = ({ children }) => {
|
||||
const { token, loading } = useContext(AuthContext);
|
||||
|
||||
if (loading) return <div>Loading...</div>;
|
||||
if (!token) return <Navigate to="/login" />;
|
||||
|
||||
return children;
|
||||
};
|
||||
export default ProtectedRoute;
|
||||
Reference in New Issue
Block a user