diff options
Diffstat (limited to 'scraper/client/paper/paper.verify.js')
| -rw-r--r-- | scraper/client/paper/paper.verify.js | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/scraper/client/paper/paper.verify.js b/scraper/client/paper/paper.verify.js index 61faa24a..f5dbc13c 100644 --- a/scraper/client/paper/paper.verify.js +++ b/scraper/client/paper/paper.verify.js @@ -140,14 +140,15 @@ class PaperVerify extends Component { institution_3: this.state.institution_3, validate_3: this.state.validate_3, }) - this.next(false) + this.next() } prev() { const { key } = this.props.api.paperInfo.dataset - const { paperInfo } = this.props.api - let citationIndex = (paperInfo.citations || []) - .findIndex(f => f.id === this.state.citation.id) + const { paperInfo, sortedCitations } = this.props.api + const citations = sortedCitations || paperInfo.citations || [] + let citationIndex = citations.findIndex(f => f.id === this.state.citation.id) + if (citationIndex === -1) { history.push('/paper/' + key + '/info/') } else { @@ -155,7 +156,7 @@ class PaperVerify extends Component { if (citationIndex < 0) { history.push('/paper/' + key + '/info/') } else { - let nextId = paperInfo.citations[citationIndex].id + let nextId = citations[citationIndex].id history.push('/paper/' + key + '/verify/' + nextId) } } @@ -163,17 +164,18 @@ class PaperVerify extends Component { next() { const { key } = this.props.api.paperInfo.dataset - const { paperInfo } = this.props.api - let citationIndex = (paperInfo.citations || []) - .findIndex(f => f.id === this.state.citation.id) + const { paperInfo, sortedCitations } = this.props.api + const citations = sortedCitations || paperInfo.citations || [] + let citationIndex = citations.findIndex(f => f.id === this.state.citation.id) + if (citationIndex === -1) { history.push('/paper/' + key + '/info/') } else { citationIndex += 1 - if (citationIndex >= paperInfo.citations.length) { + if (citationIndex >= citations.length) { history.push('/paper/' + key + '/info/') } else { - let nextId = paperInfo.citations[citationIndex].id + let nextId = citations[citationIndex].id history.push('/paper/' + key + '/verify/' + nextId) } } |
