fix(dashboard): product type metadata form (#12149)

This commit is contained in:
Frane Polić authored and GitHub committed 2025-04-11 09:14:32 +02:00
1 parent 3a1cf2212a
commit 95a8c7b57e
4 files changed
+39

No files matched your search

+5
View File
@@ -0,0 +1,5 @@
---
"@medusajs/dashboard": patch
---
fix(dashboard): product type metadata form
@@ -1414,6 +1414,13 @@ export function getRouteMap({
lazy: () => lazy: () =>
import("../../routes/product-types/product-type-edit"), import("../../routes/product-types/product-type-edit"),
}, },
{
path: "metadata/edit",
lazy: () =>
import(
"../../routes/product-types/product-type-metadata"
),
},
], ],
}, },
], ],
@@ -0,0 +1 @@
export { ProductTypeMetadata as Component } from "./product-type-metadata"
@@ -0,0 +1,26 @@
import { useParams } from "react-router-dom"
import { MetadataForm } from "../../../components/forms/metadata-form/metadata-form"
import { useProductType, useUpdateProductType } from "../../../hooks/api"
export const ProductTypeMetadata = () => {
const { id } = useParams()
const { product_type, isPending, isError, error } = useProductType(id!)
const { mutateAsync, isPending: isMutating } = useUpdateProductType(
product_type?.id!
)
if (isError) {
throw error
}
return (
<MetadataForm
metadata={product_type?.metadata}
hook={mutateAsync}
isPending={isPending}
isMutating={isMutating}
/>
)
}