From c24e1496fe6fd18e9924891cf20169dc95b5ce98 Mon Sep 17 00:00:00 2001 From: dididy Date: Fri, 20 Aug 2021 12:43:32 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20expired=20=EB=90=9C=20=20=EC=B4=88?= =?UTF-8?q?=EB=8C=80=20=EB=A9=94=EC=8B=9C=EC=A7=80=20=EB=B6=84=EA=B8=B0?= =?UTF-8?q?=EC=B2=98=EB=A6=AC=EB=A5=BC=20=ED=95=9C=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * alert 뜨도록 수정 --- .../molecules/ChatBubble/ChatBubble.tsx | 30 ++++++++++++++----- 1 file changed, 22 insertions(+), 8 deletions(-) diff --git a/FE/components/molecules/ChatBubble/ChatBubble.tsx b/FE/components/molecules/ChatBubble/ChatBubble.tsx index a70174a8..24723f69 100644 --- a/FE/components/molecules/ChatBubble/ChatBubble.tsx +++ b/FE/components/molecules/ChatBubble/ChatBubble.tsx @@ -4,6 +4,8 @@ import { DateTime } from 'luxon'; import styled from 'styled-components'; import { useRouter } from 'next/router'; import useConfetti from '@hooks/useConfetti'; +import { MODALS } from '@utils/constants'; +import { useAppDispatch, displayModal } from '@store'; import { postTeamInviteAccept, postTeamInviteReject, @@ -99,6 +101,7 @@ const ChatBubble = forwardRef( }: ChatBubbleProps, ref, ): ReactElement => { + const dispatch = useAppDispatch(); const router = useRouter(); const { popEmoji } = useConfetti(); @@ -145,14 +148,25 @@ const ChatBubble = forwardRef( { - await postTeamInviteAccept({ - invitee_id: id, - leader_id: opponentId, - message_id: chatId, - team_id: teamId, - }); - handleGetChatRoomMessages(); - popEmoji(); + try { + await postTeamInviteAccept({ + invitee_id: id, + leader_id: opponentId, + message_id: chatId, + team_id: teamId, + }); + handleGetChatRoomMessages(); + popEmoji(); + } catch ({ response: { status } }) { + if (status === 400) { + dispatch( + displayModal({ + modalName: MODALS.ALERT_MODAL, + content: '거부된 초대메세지 입니다.', + }), + ); + } + } }} funcDecline={async () => { await postTeamInviteReject({