| import React from 'react'; | |
| import { Navigate } from 'react-router-dom'; | |
| import { isUserRegistered } from '../../utils/index.ts'; | |
| type ProtectedRouteProps = { | |
| children?: any; | |
| }; | |
| const ProtectedRoute = ({ children }: ProtectedRouteProps) => { | |
| const isAuthenticated = isUserRegistered(); | |
| if (!isAuthenticated) { | |
| return <Navigate to="/" replace />; | |
| } | |
| return <>{children}</>; | |
| }; | |
| export default ProtectedRoute; | |