From 498d76b0491625bb9946f136a827aff2fd920152 Mon Sep 17 00:00:00 2001 From: Haralan Dobrev Date: Thu, 30 Mar 2023 10:23:50 +0300 Subject: [PATCH] Protect against violations without author before we saved contacts --- src/components/modules/violations/ViolationDetails.js | 6 +++--- src/components/modules/violations/ViolationList.js | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/components/modules/violations/ViolationDetails.js b/src/components/modules/violations/ViolationDetails.js index b9adb7b..c48f38c 100644 --- a/src/components/modules/violations/ViolationDetails.js +++ b/src/components/modules/violations/ViolationDetails.js @@ -399,9 +399,9 @@ export default (props) => { Имена - {data.author.firstName - ? `${data.author.firstName} ${data.author.lastName}` - : data.author.name} + {data?.author?.firstName + ? `${data?.author?.firstName} ${data?.author?.lastName}` + : data?.author?.name} {data.author?.organization && ( diff --git a/src/components/modules/violations/ViolationList.js b/src/components/modules/violations/ViolationList.js index bf5a98e..6070816 100644 --- a/src/components/modules/violations/ViolationList.js +++ b/src/components/modules/violations/ViolationList.js @@ -293,9 +293,9 @@ export default (props) => { {violation.town.name} - {violation.author.firstName + {violation?.author?.firstName ? `${violation.author.firstName} ${violation.author.lastName}` - : violation.author.name} + : violation?.author?.name} {violation.description.slice(0, 40) + '...'}