|
1
|
import { HttpTypes } from "@medusajs/types" |
|
2
|
import { UIMatch } from "react-router-dom" |
|
3
|
|
|
4
|
import { useCustomerGroup } from "../../../hooks/api" |
|
5
|
import { CUSTOMER_GROUP_DETAIL_FIELDS } from "./constants" |
|
6
|
|
|
7
|
type CustomerGroupDetailBreadcrumbProps = |
|
8
|
UIMatch<HttpTypes.AdminCustomerGroupResponse> |
|
9
|
|
|
10
|
export const CustomerGroupDetailBreadcrumb = ( |
|
11
|
props: CustomerGroupDetailBreadcrumbProps |
|
12
|
) => { |
|
13
|
const { id } = props.params || {} |
|
14
|
|
|
15
|
const { customer_group } = useCustomerGroup( |
|
16
|
id!, |
|
17
|
{ |
|
18
|
fields: CUSTOMER_GROUP_DETAIL_FIELDS, |
|
19
|
}, |
|
20
|
{ |
|
21
|
initialData: props.loaderData, |
|
22
|
enabled: Boolean(id), |
|
23
|
} |
|
24
|
) |
|
25
|
|
|
26
|
if (!customer_group) { |
|
27
|
return null |
|
28
|
} |
|
29
|
|
|
30
|
return <span>{customer_group.name}</span> |
|
31
|
} |
|
32
|
|
|
33
|
export const seo = (match: UIMatch<HttpTypes.AdminCustomerGroupResponse>) => ({ |
|
34
|
title: match.loaderData?.customer_group?.name, |
|
35
|
}) |