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