Raw
1 import { HttpTypes } from "@medusajs/types"
2 import { UIMatch } from "react-router-dom"
3 import { usePromotion } from "../../../hooks/api"
4
5 type PromotionDetailBreadcrumbProps = UIMatch<HttpTypes.AdminPromotionResponse>
6
7 export const PromotionDetailBreadcrumb = (
8 props: PromotionDetailBreadcrumbProps
9 ) => {
10 const { id } = props.params || {}
11
12 const { promotion } = usePromotion(id!, {
13 initialData: props.loaderData,
14 enabled: Boolean(id),
15 })
16
17 if (!promotion) {
18 return null
19 }
20
21 return <span>{promotion.code}</span>
22 }
23
24 export const seo = (match: UIMatch<HttpTypes.AdminPromotionResponse>) => ({
25 title: match.loaderData?.promotion?.code,
26 })