haixunMaster/haixun-backend/web/src/components/MatrixEntryRoute.tsx

13 lines
514 B
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import { Navigate, useLocation } from 'react-router-dom'
import { brandIdFromSearch } from '../lib/placementFlow'
import { CopyMatrixPage } from '../pages/CopyMatrixPage'
/** /matrix無 brand 參數為流程 A舊書籤 ?brand= 導向 /brand-matrix */
export function MatrixEntryRoute() {
const { search } = useLocation()
const brandId = brandIdFromSearch(search)
if (brandId) {
return <Navigate to={`/brand-matrix?brand=${encodeURIComponent(brandId)}`} replace />
}
return <CopyMatrixPage />
}