import React from 'react'; import { Navigate, useLocation } from 'react-router-dom'; import { getToken } from './authMemory.js'; export default function ProtectedRoute({ children }) { const location = useLocation(); const token = getToken(); if (!token) { const next = encodeURIComponent(location.pathname + location.search); return ; } return children; }