Skip to content

Commit

Permalink
Add case for only resource address missing
Browse files Browse the repository at this point in the history
  • Loading branch information
ravicodelabs committed Aug 8, 2024
1 parent 361691f commit ea10190
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/components/SelectedTapDetails/SelectedTapDetails.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,18 @@ function SelectedTapDetails(props) {
const latLongFormatted = getFormattedLatLong(resource.latitude, resource.longitude);

// Assign title and subtitles, using fallbacks when data is missing
let resourceTitle, resourceSubtitleOne, resourceSubtitleTwo;
if (resource.name.trim().length > 0) {
let resourceTitle = "", resourceSubtitleOne, resourceSubtitleTwo;
if (resource.name !== undefined && resource.name.trim().length > 0 &&
resource.address !== undefined && resource.address.trim().length > 0) {
resourceTitle = resource.name;
resourceSubtitleOne = resource.address;
resourceSubtitleTwo = latLongFormatted;
}
else if (resource.address.trim().length > 0) {
else if (resource.name !== undefined && resource.name.trim().length > 0) {
resourceTitle = resource.name;
resourceSubtitleOne = latLongFormatted;
}
else if (resource.address !== undefined && resource.address.trim().length > 0) {
resourceTitle = resource.address;
resourceSubtitleOne = latLongFormatted;
}
Expand Down

0 comments on commit ea10190

Please sign in to comment.