Skip to content
Snippets Groups Projects
Commit ab83831a authored by Audrey Hamelers's avatar Audrey Hamelers
Browse files

#455

parent 0d6c52da
No related branches found
No related tags found
2 merge requests!102Shared data model,!103Dev
This commit is part of merge request !103. Comments created here will be created in the context of that merge request.
...@@ -204,16 +204,18 @@ class PubMedSearch extends React.Component { ...@@ -204,16 +204,18 @@ class PubMedSearch extends React.Component {
async onSelected(result, journal) { async onSelected(result, journal) {
const inPMC = result.articleids.find(id => id.idtype === 'pmc') const inPMC = result.articleids.find(id => id.idtype === 'pmc')
if (inPMC) { if (inPMC) {
this.setState({ loading: true })
const obj = { const obj = {
inPMC: result.title, inPMC: result.title,
pmcid: inPMC.value, pmcid: inPMC.value,
loading: false,
} }
const epmcURL = `https://www.ebi.ac.uk/europepmc/webservices/rest/search?query=SRC:MED%20EXT_ID:${ const epmcURL = `https://www.ebi.ac.uk/europepmc/webservices/rest/search?query=SRC:MED%20EXT_ID:${
result.uid result.uid
}&resulttype=lite&format=json` }&resulttype=lite&format=json`
const response = await fetch(epmcURL) const response = await fetch(epmcURL)
const json = await response.json() const json = await response.json()
const epmc = json.resultList.result[0].inEPMC const epmc = json.resultList.result[0] && json.resultList.result[0].inEPMC
if (epmc === 'Y') { if (epmc === 'Y') {
obj.inEPMC = true obj.inEPMC = true
} }
......
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