From abaf86e6f916f0e364ed0005dde51107b65f9c8d Mon Sep 17 00:00:00 2001 From: meetul Date: Sat, 26 Oct 2024 11:10:00 +0530 Subject: [PATCH] minor change --- src/components/AddPeopleToTag/AddPeopleToTag.tsx | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/components/AddPeopleToTag/AddPeopleToTag.tsx b/src/components/AddPeopleToTag/AddPeopleToTag.tsx index cf023353c6..e2ca6ca89d 100644 --- a/src/components/AddPeopleToTag/AddPeopleToTag.tsx +++ b/src/components/AddPeopleToTag/AddPeopleToTag.tsx @@ -16,6 +16,7 @@ import { toast } from 'react-toastify'; import { ADD_PEOPLE_TO_TAG } from 'GraphQl/Mutations/TagMutations'; import InfiniteScroll from 'react-infinite-scroll-component'; import { WarningAmberRounded } from '@mui/icons-material'; +import { useTranslation } from 'react-i18next'; /** * Props for the `AddPeopleToTag` component. @@ -43,6 +44,8 @@ const AddPeopleToTag: React.FC = ({ }) => { const { tagId: currentTagId } = useParams(); + const { t: tErrors } = useTranslation('error'); + const [assignToMembers, setAssignToMembers] = useState( [], ); @@ -164,9 +167,9 @@ const AddPeopleToTag: React.FC = ({ } } catch (error: unknown) { /* istanbul ignore next */ - if (error instanceof Error) { - toast.error(error.message); - } + const errorMessage = + error instanceof Error ? error.message : tErrors('unknownError'); + toast.error(errorMessage); } };