import React, { useEffect, useState } from 'react'; import axios from 'axios'; import { useParams } from 'react-router-dom'; const CustomerDetails = () => { const { id } = useParams(); const [customer, setCustomer] = useState(null); useEffect(() => { const fetchCustomer = async () => { try { const response = await axios.get(`http://localhost:8080/api/customers/${id}`); setCustomer(response.data); } catch (error) { console.error('Error fetching customer:', error); } }; fetchCustomer(); }, [id]); if (!customer) { return
Email: {customer.email}
Phone: {customer.phone}
Address: {customer.address}
Membership Level: {customer.membershipLevel}
Registration Date: {new Date(customer.registrationDate).toLocaleString()}