import React, { useState, useEffect } from 'react'; import { useParams } from "react-router-dom"; import MatrimonyProfile from "../components/profiledetail/MatrimonyProfile" import PartnerPreferences from "../components/profiledetail/PartnerPreferences" import MatchingList from "../components/profiledashboard/MatchingList"; import { getProfileDetail } from "../services/profileActionApi"; import { CircularProgress, Box } from "@mui/material"; const ProfileDetailPage = () => { const { id } = useParams(); const [data, setData] = useState(null); const [loading, setLoading] = useState(true); const fetchDetail = async (showLoading = true) => { if (showLoading) setLoading(true); try { const res = await getProfileDetail(id); setData(res); } catch (error) { console.error("Failed to fetch profile details:", error); } finally { if (showLoading) setLoading(false); } }; useEffect(() => { if (id) { fetchDetail(); } }, [id]); if (loading) { return ( ); } if (!data) { return (
Profile details not found.
); } return ( <>
); }; export default ProfileDetailPage;