|
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 { VisuallyHidden } from "../../../components/utilities/visually-hidden" |
|
6
|
import { useApiKey } from "../../../hooks/api/api-keys" |
|
7
|
import { EditApiKeyForm } from "./components/edit-api-key-form" |
|
8
|
|
|
9
|
export const ApiKeyManagementEdit = () => { |
|
10
|
const { id } = useParams() |
|
11
|
const { t } = useTranslation() |
|
12
|
|
|
13
|
const { api_key, isLoading, isError, error } = useApiKey(id!) |
|
14
|
|
|
15
|
if (isError) { |
|
16
|
throw error |
|
17
|
} |
|
18
|
|
|
19
|
return ( |
|
20
|
<RouteDrawer> |
|
21
|
<RouteDrawer.Header> |
|
22
|
<RouteDrawer.Title asChild> |
|
23
|
<Heading>{t("apiKeyManagement.edit.header")}</Heading> |
|
24
|
</RouteDrawer.Title> |
|
25
|
<RouteDrawer.Description asChild> |
|
26
|
<VisuallyHidden> |
|
27
|
{t("apiKeyManagement.edit.description")} |
|
28
|
</VisuallyHidden> |
|
29
|
</RouteDrawer.Description> |
|
30
|
</RouteDrawer.Header> |
|
31
|
{!isLoading && !!api_key && <EditApiKeyForm apiKey={api_key} />} |
|
32
|
</RouteDrawer> |
|
33
|
) |
|
34
|
} |