import React, { useEffect } from 'react';
import { useNavigate } from 'react-router-dom';

function Logout() {
  const navigate = useNavigate();

  useEffect(() => {
    const handleLogout = () => {
      // Clear any stored user data (e.g., tokens) here
      localStorage.removeItem('token'); // Example, adjust based on your implementation
      navigate('/login');
    };

    handleLogout();
  }, [navigate]);

  return null; // Or a loading spinner/message if desired
}

export default Logout;
