Skip to content

Commit

Permalink
fix: handle response of array and undefiend data
Browse files Browse the repository at this point in the history
  • Loading branch information
areisle committed Feb 11, 2022
1 parent 3d44e44 commit 14b4c18
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/views/ImportPubmedView/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ const ImportPubmedView = (props) => {
({ queryKey: [route, body] }) => api.post(route, body),
{
onError: err => handleErrorSaveLocation(err, history),
select: response => response['@rid'],
select: response => response[0]?.['@rid'],
},
);

Expand Down Expand Up @@ -109,7 +109,7 @@ const ImportPubmedView = (props) => {
placeholder="Enter a PubMed ID ex. 1234"
value={text}
/>
{currentRecords.map(rec => (
{currentRecords?.map(rec => (
<PubmedCard
key={rec['@rid']}
abstract={rec.description}
Expand Down

0 comments on commit 14b4c18

Please sign in to comment.