'use client'; import { Cog8ToothIcon, CubeIcon, UserCircleIcon } from '@heroicons/react/24/outline'; import { Avatar } from '@nextui-org/react'; import LogoutButton from 'components/button/logout'; import { Customer } from 'lib/woocomerce/models/customer'; import { Shipping } from 'lib/woocomerce/models/shipping'; import Link from 'next/link'; import { useEffect, useState } from 'react'; export default function ProfileLayout({ user }: { user: React.ReactNode }) { const [customer, setCustomer] = useState(undefined); const [shippingAddress, setShippingAddress] = useState(undefined); useEffect(() => { const fetchCustomer = async () => { const data = (await ( await fetch('/api/customer', { method: 'GET', headers: { 'Content-Type': 'application/json' } }) ).json()) as Customer; setCustomer(data); }; fetchCustomer(); }, []); return (
{customer && (
Ciao {customer.first_name}
)}
{user}
); }