|
1
|
import { Heading } from "@medusajs/ui" |
|
2
|
import { useTranslation } from "react-i18next" |
|
3
|
import { RouteDrawer } from "../../../components/modals" |
|
4
|
import { useMe } from "../../../hooks/api/users" |
|
5
|
import { EditProfileForm } from "./components/edit-profile-form/edit-profile-form" |
|
6
|
|
|
7
|
export const ProfileEdit = () => { |
|
8
|
const { user, isPending: isLoading, isError, error } = useMe() |
|
9
|
|
|
10
|
const { t } = useTranslation() |
|
11
|
|
|
12
|
if (isError) { |
|
13
|
throw error |
|
14
|
} |
|
15
|
|
|
16
|
return ( |
|
17
|
<RouteDrawer> |
|
18
|
<RouteDrawer.Header className="capitalize"> |
|
19
|
<RouteDrawer.Title asChild> |
|
20
|
<Heading>{t("profile.edit.header")}</Heading> |
|
21
|
</RouteDrawer.Title> |
|
22
|
</RouteDrawer.Header> |
|
23
|
{!isLoading && user && <EditProfileForm user={user} />} |
|
24
|
</RouteDrawer> |
|
25
|
) |
|
26
|
} |