Raw
1 import { useParams } from "react-router-dom"
2 import { MetadataForm } from "../../../components/forms/metadata-form/metadata-form"
3 import { useCollection, useUpdateCollection } from "../../../hooks/api"
4
5 export const CollectionMetadata = () => {
6 const { id } = useParams()
7
8 const { collection, isPending, isError, error } = useCollection(id!)
9
10 const { mutateAsync, isPending: isMutating } = useUpdateCollection(
11 collection?.id!
12 )
13
14 if (isError) {
15 throw error
16 }
17
18 return (
19 <MetadataForm
20 metadata={collection?.metadata}
21 hook={mutateAsync}
22 isPending={isPending}
23 isMutating={isMutating}
24 />
25 )
26 }