32 lines
731 B
JavaScript
32 lines
731 B
JavaScript
import React from 'react';
|
|
import { connect } from 'react-redux';
|
|
import { withRouter } from 'react-router-dom';
|
|
|
|
import './index.scss';
|
|
|
|
const mapState = state => ({
|
|
locale: state.common.locale,
|
|
config: state.common.config
|
|
})
|
|
|
|
const APIUrl = props => {
|
|
|
|
const { collectionSlug, id } = props.match.params;
|
|
|
|
const apiUrl = `${props.config.serverUrl}/${collectionSlug}/${id}`;
|
|
|
|
return (
|
|
<div className="api-url">
|
|
<span className="uppercase-label">API URL</span>
|
|
{id &&
|
|
<div className="url"><a href={apiUrl} rel="noopener noreferrer" target="_blank">{apiUrl}</a></div>
|
|
}
|
|
{!id &&
|
|
<div>—</div>
|
|
}
|
|
</div>
|
|
);
|
|
};
|
|
|
|
export default withRouter(connect(mapState)(APIUrl));
|