feat(medusa,dashboard): Add metadata UI to product tags domain + retrieve metadata by default (#13272)
This commit is contained in:
committed by
GitHub
parent
2d62e28913
commit
7f5b9fc5fa
@@ -1329,6 +1329,13 @@ export function getRouteMap({
|
||||
lazy: () =>
|
||||
import("../../routes/product-tags/product-tag-edit"),
|
||||
},
|
||||
{
|
||||
path: "metadata/edit",
|
||||
lazy: () =>
|
||||
import(
|
||||
"../../routes/product-tags/product-tag-metadata"
|
||||
),
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
|
||||
@@ -40,6 +40,7 @@ export const ProductTagDetail = () => {
|
||||
before: getWidgets("product_tag.details.before"),
|
||||
}}
|
||||
showJSON
|
||||
showMetadata
|
||||
data={product_tag}
|
||||
>
|
||||
<ProductTagGeneralSection productTag={product_tag} />
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
export { ProductTagMetadata as Component } from "./product-tag-metadata"
|
||||
@@ -0,0 +1,26 @@
|
||||
import { useParams } from "react-router-dom"
|
||||
import { MetadataForm } from "../../../components/forms/metadata-form/metadata-form"
|
||||
import { useProductTag, useUpdateProductTag } from "../../../hooks/api"
|
||||
|
||||
export const ProductTagMetadata = () => {
|
||||
const { id } = useParams()
|
||||
|
||||
const { product_tag, isPending, isError, error } = useProductTag(id!)
|
||||
|
||||
const { mutateAsync, isPending: isMutating } = useUpdateProductTag(
|
||||
product_tag?.id!
|
||||
)
|
||||
|
||||
if (isError) {
|
||||
throw error
|
||||
}
|
||||
|
||||
return (
|
||||
<MetadataForm
|
||||
metadata={product_tag?.metadata}
|
||||
hook={mutateAsync}
|
||||
isPending={isPending}
|
||||
isMutating={isMutating}
|
||||
/>
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user