"use client"; 

import DashboardNav from "@/components/othersPages/dashboard/DashboardNav";
import Orders from "@/components/othersPages/dashboard/Orders";
import AccountEdit from "@/components/othersPages/dashboard/AccountEdit";
import AccountAddresses from "@/components/othersPages/dashboard/AccountAddresses"; 
import React from "react";
import { useState, useEffect } from 'react'; 
import { fetchWrapper } from "@/helpers";

import { useT } from '@/context/I18nContext'; 

export default function Page() {
     const [userData, setUserData] = useState([]); 

     useEffect(() => {
          const fetchUserData = async () => {
               const data = await fetchWrapper.get('/api/users/getdata');
               setUserData(data[0].userData);
          };

          fetchUserData();
     }, []);

     const { t } = useT(); 

	return (
		<>
		
			<div className='tf-page-title'>
				<div className='container-full'>
					<div className='heading text-center'>{t("contul_meu_heading")}</div>
				</div>
			</div>
			<section className='flat-spacing-11'>
				<div className='container'>
					<div className='row'>
						<div className='col-lg-3'>
							<DashboardNav userData={userData} />
						</div>
						<div className='col-lg-9'>
                                   <AccountEdit />
							<Orders />
                                   <AccountAddresses />
						</div>
					</div>
				</div>
			</section>

		
		</>
	);
}