1 import { Heading } from "@medusajs/ui"
2 import { useTranslation } from "react-i18next"
3 import { useParams } from "react-router-dom"
4 import { RouteDrawer } from "../../../components/modals"
5 import { useCustomer } from "../../../hooks/api/customers"
6 import { EditCustomerForm } from "./components/edit-customer-form"
7
8 export const CustomerEdit = () => {
9 const { t } = useTranslation()
10
11 const { id } = useParams()
12 const { customer, isLoading, isError, error } = useCustomer(id!)
13
14 if (isError) {
15 throw error
16 }
17
18 return (
19 <RouteDrawer>
20 <RouteDrawer.Header>
21 <Heading>{t("customers.edit.header")}</Heading>
22 </RouteDrawer.Header>
23 {!isLoading && customer && <EditCustomerForm customer={customer} />}
24 </RouteDrawer>
25 )
26 }