Commit 786f6a91 authored by Viacheslav Pavlov's avatar Viacheslav Pavlov
Browse files

URL for accessions with DOI

parent f1cba03a
......@@ -7,6 +7,7 @@ import { withStyles } from '@material-ui/core/styles';
// Actions
import { loadAccession, applyFilters, loadAccessionAuditLog } from 'accessions/actions/public';
import {addAccessionToMyList, removeAccessionFromMyList} from 'list/actions/public';
import navigateTo from 'actions/navigation';
// Constants
import { ROLE_USER } from 'constants/userRoles';
......@@ -72,6 +73,7 @@ interface IBrowsePageProps {
addAccessionToMyList: any;
removeAccessionFromMyList: any;
applyFilters: any;
navigateTo: (location: string) => void;
}
class BrowsePage extends React.Component<IBrowsePageProps, any> {
......@@ -99,6 +101,15 @@ class BrowsePage extends React.Component<IBrowsePageProps, any> {
}
}
public componentWillReceiveProps(nextProps): void {
const {uuid, doi, navigateTo} = this.props;
const accession = this.props.accession ? this.props.accession.details : null;
if (accession && accession.doi && !doi && accession.uuid === uuid) {
navigateTo(`/${accession.doi}`);
}
}
private loadAuditLog = () => {
const { doi, uuid, loadAccessionAuditLog } = this.props;
......@@ -508,6 +519,7 @@ const mapDispatchToProps = (dispatch) => bindActionCreators({
loadAccession,
loadAccessionAuditLog,
applyFilters,
navigateTo,
}, dispatch);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment