Skip to content

Commit

Permalink
fix: remove doi internal value check from crossref method
Browse files Browse the repository at this point in the history
  • Loading branch information
dmijatovic committed Oct 12, 2022
1 parent 92a6bd4 commit f395590
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions frontend/utils/getCrossref.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,13 +72,16 @@ export async function getCrossrefItemByDoi(doi: string) {

if (resp.status === 200) {
const json: CrossrefResponse = await resp.json()
// find doi item
const doiItem = json.message.items.filter(item => item.DOI.toLowerCase() === doi.toLocaleLowerCase())
// if found return it
if (doiItem.length === 1) {
// if found return item
if (json.message.items.length > 0) {
return {
status: 200,
message: doiItem[0]
message: json.message.items[0]
}
} else {
return {
status: 404,
message: 'DOI not found'
}
}
}
Expand Down

0 comments on commit f395590

Please sign in to comment.