import React from 'react'; import { connect } from 'react-redux'; import { pick } from 'ramda'; import { getShortUrlVisits } from './reducers/shortUrlVisits'; export class ShortUrlsVisits extends React.Component { componentDidMount() { const { match: { params } } = this.props; this.props.getShortUrlVisits(params.shortCode); } render() { const { match: { params }, selectedServer } = this.props; const serverUrl = selectedServer ? selectedServer.url : ''; const shortUrl = `${serverUrl}/${params.shortCode}`; return (

Visit stats for {shortUrl}

{/* TODO Once Shlink's API allows it, add total visits counter, long URL and creation time */}
); } } export default connect(pick(['selectedServer']), { getShortUrlVisits })(ShortUrlsVisits);