Skip to content

Commit

Permalink
fix: expired 된 초대 메시지 분기처리를 한다
Browse files Browse the repository at this point in the history
* alert 뜨도록 수정
  • Loading branch information
dididy committed Aug 20, 2021
1 parent fb89bc2 commit c24e149
Showing 1 changed file with 22 additions and 8 deletions.
30 changes: 22 additions & 8 deletions FE/components/molecules/ChatBubble/ChatBubble.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -99,6 +101,7 @@ const ChatBubble = forwardRef<HTMLInputElement, ChatBubbleProps>(
}: ChatBubbleProps,
ref,
): ReactElement => {
const dispatch = useAppDispatch();
const router = useRouter();
const { popEmoji } = useConfetti();

Expand Down Expand Up @@ -145,14 +148,25 @@ const ChatBubble = forwardRef<HTMLInputElement, ChatBubbleProps>(
<ChatBubbleSelect
text="팀원초대 요청"
funcAccept={async () => {
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({
Expand Down

0 comments on commit c24e149

Please sign in to comment.