mirror of
https://git.meshkee.com/BaloutPastry/website.git
synced 2026-08-11 22:31:01 +04:30
14 lines
454 B
TypeScript
14 lines
454 B
TypeScript
import { useParams } from 'react-router-dom'
|
|
import { isCuid } from '../lib/ids'
|
|
import ProductDetailPage from './ProductDetailPage'
|
|
import ProductsListPage from './ProductsListPage'
|
|
|
|
/** `/products/:slugOrId` — category slug list, or product detail when cuid. */
|
|
export default function ProductsSlugOrDetailPage() {
|
|
const { slugOrId = '' } = useParams()
|
|
if (isCuid(slugOrId)) {
|
|
return <ProductDetailPage />
|
|
}
|
|
return <ProductsListPage />
|
|
}
|