mirror of
https://github.com/vercel/commerce.git
synced 2025-07-26 03:31:23 +00:00
feat: get-edit-user-info
This commit is contained in:
@@ -13,7 +13,6 @@ import { PRODUCT_CART_DATA_TEST } from 'src/utils/demo-data';
|
||||
import { ACCOUNT_TAB, QUERY_KEY } from "src/utils/constanst.utils"
|
||||
import { useRouter } from "next/router"
|
||||
import { useActiveCustomer } from 'src/components/hooks/auth'
|
||||
import useUserInfo from "src/components/hooks/user/useUserInfo"
|
||||
import { AccountProps } from "./components/AccountInfomation/AccountInfomation"
|
||||
const waiting = [
|
||||
{
|
||||
@@ -54,17 +53,6 @@ const delivered = [
|
||||
}
|
||||
]
|
||||
|
||||
let account = {
|
||||
firstName: "Nhân",
|
||||
lastName: "Trần",
|
||||
email: "vuduong@gmail.com",
|
||||
address: "235 Dien Bien Phu Bis, Dakao ward",
|
||||
state: "District 1",
|
||||
city: "HCMC",
|
||||
postalCode: "700000",
|
||||
phoneNumber: "(+84) 937 937 195"
|
||||
}
|
||||
|
||||
interface AccountPageProps {
|
||||
defaultActiveContent?: "info" | "orders" | "favorites"
|
||||
}
|
||||
@@ -84,18 +72,8 @@ const getTabIndex = (tab?: string): number => {
|
||||
const AccountPage = ({ defaultActiveContent="orders" } : AccountPageProps) => {
|
||||
const router = useRouter()
|
||||
|
||||
const {userInfo} = useUserInfo();
|
||||
|
||||
// const email = userInfo?.emailAddress;
|
||||
// const [info] = userInfo?.addresses || [];
|
||||
|
||||
// const accountInfo = {...info,userInfo?.emailAddress};
|
||||
|
||||
// const clone:AccountProps = Object.create(accountInfo);
|
||||
// Object.assign(clone, accountInfo);
|
||||
|
||||
|
||||
console.log();
|
||||
const {userInfo} = useActiveCustomer();
|
||||
|
||||
|
||||
const [activeTab, setActiveTab] = useState(defaultActiveContent==="info" ? 0 : defaultActiveContent==="orders" ? 1 : 2)
|
||||
const [modalVisible, setModalVisible] = useState(false);
|
||||
@@ -123,7 +101,7 @@ const AccountPage = ({ defaultActiveContent="orders" } : AccountPageProps) => {
|
||||
|
||||
<AccountNavigation defaultActiveIndex={activeTab}>
|
||||
<TabPane tabName="Customer Information">
|
||||
<AccountInfomation account={account} onClick={showModal} />
|
||||
<AccountInfomation account={userInfo} onClick={showModal} />
|
||||
</TabPane>
|
||||
<TabPane tabName="Your Orders">
|
||||
<OrderInfomation waiting={waiting} delivering={delivering} delivered={delivered} />
|
||||
@@ -133,7 +111,7 @@ const AccountPage = ({ defaultActiveContent="orders" } : AccountPageProps) => {
|
||||
</TabPane>
|
||||
</AccountNavigation>
|
||||
</section>
|
||||
<EditInfoModal accountInfo={account} closeModal={closeModal} visible={modalVisible} />
|
||||
<EditInfoModal accountInfo={userInfo} closeModal={closeModal} visible={modalVisible} />
|
||||
</>
|
||||
)
|
||||
}
|
||||
|
Reference in New Issue
Block a user