Spaces:
Sleeping

emotion-ui / src /components /ProtectedRoute.jsx
Aya
clean deploy emotion ui frontend
20d0e47
Raw History Blame Contribute Delete
483 Bytes
// src/components/ProtectedRoute.jsx
import React from 'react';
import { useAuth } from '../contexts/AuthContext';
const ProtectedRoute = ({ children }) => {
const { isAuthenticated, loading } = useAuth();
if (loading) {
return (
<div className="loading-container">
<div className="spinner"></div>
<p>Loading...</p>
</div>
);
}
if (!isAuthenticated) {
return <LoginPage />;
}
return children;
};
export default ProtectedRoute;