Skip to content

Commit

Permalink
Handle missing data gratefully.
Browse files Browse the repository at this point in the history
  • Loading branch information
alan-wu committed May 23, 2022
1 parent 5f415e8 commit 875c5a0
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/components/Tooltip.vue
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,9 @@ const titleCase = (str) => {
}
const capitalise = function(str){
return str.charAt(0).toUpperCase() + str.slice(1)
if (str)
return str.charAt(0).toUpperCase() + str.slice(1)
return ""
}
export default {
Expand Down Expand Up @@ -214,9 +216,10 @@ export default {
body: JSON.stringify(data),
})
.then(response => response.json())
.then(data => {
.then(payload => {
uberons.forEach((el,i)=>{
uberonMap[el] = data.values[i][0]
if (payload.values[i])
uberonMap[el] = payload.values[i][0]
})
resolve(uberonMap)
})
Expand Down

0 comments on commit 875c5a0

Please sign in to comment.