From bc7467bfa02f07729180e8367440ead8c2cd5408 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Let=C3=ADcia=20Camara?= Date: Tue, 13 Nov 2018 18:11:59 -0200 Subject: [PATCH] Fix empty telegram crash --- src/components/pages/AmbassadorsPage.js | 9 +++++++ src/components/pages/MerchantsPage.js | 34 +++++++++++++++---------- 2 files changed, 29 insertions(+), 14 deletions(-) diff --git a/src/components/pages/AmbassadorsPage.js b/src/components/pages/AmbassadorsPage.js index 161cc77..503bd13 100644 --- a/src/components/pages/AmbassadorsPage.js +++ b/src/components/pages/AmbassadorsPage.js @@ -205,6 +205,15 @@ class AmbassadorsPage extends Component { const infoDescription =
Address: {merchant.address}
{(merchant.phone) && (
Phone: {merchant.phone}
)} + {(merchant.telegram) && (
Telegram: + {merchant.telegram} +
)} + {(merchant.website) && (
Website:: {stripProtocol(merchant.website)}
)}
; const marker = { lat: merchant.lat, diff --git a/src/components/pages/MerchantsPage.js b/src/components/pages/MerchantsPage.js index 25e1958..155e77b 100644 --- a/src/components/pages/MerchantsPage.js +++ b/src/components/pages/MerchantsPage.js @@ -59,8 +59,8 @@ const columnData = [ { id: 'country', numeric: false, disablePadding: true, label: 'Country' }, { id: 'phone', numeric: false, disablePadding: true, label: 'Phone' }, { id: 'link', numeric: false, disablePadding: false, label: 'Website' }, - { id: 'telegram', numeric: false, disablePadding: true, label: 'telegram' }, - { id: 'website', numeric: false, disablePadding: true, label: 'website' }, + { id: 'telegram', numeric: false, disablePadding: true, label: 'Telegram' }, + { id: 'website', numeric: false, disablePadding: true, label: 'Website' }, { id: 'map', numeric: false, disablePadding: false, label: 'Maps', disableSearch: true} ]; @@ -208,18 +208,24 @@ class MerchantsPage extends Component {
Address: {merchant.address}
{(merchant.phone) && (
Phone: {merchant.phone}
)} ; - merchant.telegram_original = merchant.telegram; - merchant.telegram = { - searchText: merchant.telegram, - value: ( - {merchant.telegram} - ) - }; + if(merchant.telegram){ + merchant.telegram_original = merchant.telegram; + merchant.telegram = { + searchText: merchant.telegram, + value: ( + {merchant.telegram} + ) + }; + } + else{ + + } + merchant.link = { searchText: stripProtocol(merchant.website), value: (