From 0dacd5ec89c806b0ceb920681aca753695c382dc Mon Sep 17 00:00:00 2001 From: xmflsct Date: Wed, 1 Feb 2023 14:52:16 +0100 Subject: [PATCH] Fix error message returning key in poll --- src/components/Timeline/Shared/Poll.tsx | 31 +++++++++++++------------ 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/src/components/Timeline/Shared/Poll.tsx b/src/components/Timeline/Shared/Poll.tsx index 775cff83..2229e505 100644 --- a/src/components/Timeline/Shared/Poll.tsx +++ b/src/components/Timeline/Shared/Poll.tsx @@ -50,21 +50,22 @@ const TimelinePoll: React.FC = () => { }, onError: (err: any, params) => { const theParams = params as MutationVarsTimelineUpdateStatusProperty - displayMessage({ - theme, - type: 'error', - message: t('common:message.error.message', { - // @ts-ignore - function: t(`componentTimeline:shared.poll.meta.button.${theParams.payload.type}` as any) - }), - ...(err.status && - typeof err.status === 'number' && - err.data && - err.data.error && - typeof err.data.error === 'string' && { - description: err.data.error - }) - }) + if (theParams.payload.type === 'poll') { + displayMessage({ + theme, + type: 'error', + message: t('common:message.error.message', { + function: t(`componentTimeline:shared.poll.meta.button.${theParams.payload.action}`) + }), + ...(err.status && + typeof err.status === 'number' && + err.data && + err.data.error && + typeof err.data.error === 'string' && { + description: err.data.error + }) + }) + } queryClient.invalidateQueries(queryKey) } })