import { Navigate } from 'react-router-dom'
import useUserStore from '@/stores/userStore'

function ProtectedRoute({ children }) {
  const token = localStorage.getItem('access_token')

  if (!token) {
    return <Navigate to="/login" replace />
  }

  return children
}

export default ProtectedRoute
