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