4
0
forked from crowetic/commerce
commerce/pages/profile.tsx

38 lines
1.0 KiB
TypeScript
Raw Normal View History

2020-10-27 00:47:29 -05:00
import type { GetStaticPropsContext } from 'next'
import getAllPages from '@lib/bigcommerce/api/operations/get-all-pages'
import useCustomer from '@lib/bigcommerce/use-customer'
2020-10-24 16:53:25 -03:00
import { Layout } from '@components/core'
2020-10-24 17:55:30 -03:00
import { Container, Text } from '@components/ui'
2020-10-27 00:47:29 -05:00
export async function getStaticProps({ preview }: GetStaticPropsContext) {
const { pages } = await getAllPages({ preview })
return {
props: { pages },
}
}
2020-10-27 00:20:11 -05:00
2020-10-24 16:53:25 -03:00
export default function Profile() {
2020-10-26 09:43:34 -03:00
const { data } = useCustomer()
2020-10-24 16:53:25 -03:00
return (
<Container>
2020-10-24 17:55:30 -03:00
<Text variant="pageHeading">My Profile</Text>
2020-10-26 10:20:34 -03:00
{data && (
<div className="max-w-2xl flex flex-col space-y-5">
<div>
<Text variant="sectionHeading">Full Name</Text>
<span>
{data.firstName} {data.lastName}
</span>
</div>
<div>
<Text variant="sectionHeading">Email</Text>
<span>{data.email}</span>
</div>
2020-10-26 09:43:34 -03:00
</div>
2020-10-26 10:20:34 -03:00
)}
2020-10-24 16:53:25 -03:00
</Container>
)
}
Profile.Layout = Layout