import { replace as replaceFn } from 'connected-react-router' ; import { FunctionComponent } from 'react' ; import { connect } from 'react-redux' ; import { RouteComponentProps } from 'react-router-dom' ; interface IProps { replace : typeof replaceFn ; } interface IParams { key : string ; } const Legacy = ( { match , replace , } ) => { try { const [ , oldKey ] = match . params . key . split ( '-' ) ; const newKey = parseInt ( oldKey , 10 ) . toString ( 16 ) ; replace ( `/beatmap/${ newKey }` ) ; } catch ( err ) { replace ( '/' ) ; } return null ; } ; const ConnectedLegacy = connect ( null , { replace : replaceFn , } ) ( Legacy ) ; export { ConnectedLegacy as Legacy } ;