Skip to content

Commit

Permalink
fix:여러번 누를 수 있는 버튼은 따닥 문제 해결 X
Browse files Browse the repository at this point in the history
  • Loading branch information
ss0526100 committed Oct 24, 2024
1 parent af8829d commit 7e9185b
Showing 1 changed file with 1 addition and 20 deletions.
21 changes: 1 addition & 20 deletions frontend/src/pages/Moim/MoimDetailPage/MoimDetailPage.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { MoimInfo, Role } from '@_types/index';
import { useMemo, useRef } from 'react';
import { useNavigate, useParams } from 'react-router-dom';

import BackLogo from '@_common/assets/back.svg';
Expand All @@ -26,6 +25,7 @@ import useChamyoMine from '@_hooks/queries/useChamyoMine';
import useChangeZzim from '@_hooks/mutaions/useChangeZzim';
import useCompleteMoin from '@_hooks/mutaions/useCompleteMoin';
import useJoinMoim from '@_hooks/mutaions/useJoinMoim';
import { useMemo } from 'react';
import useMoim from '@_hooks/queries/useMoim';
import useOpenChat from '@_hooks/mutaions/useOpenChat';
import useReopenMoim from '@_hooks/mutaions/useReopenMoim';
Expand Down Expand Up @@ -109,13 +109,6 @@ export default function MoimDetailPage() {
navigate(GET_ROUTES.nowDarakbang.chattingRoom(chatRoomId)),
);

const isMoimCanceled = useRef(false);
const isReopened = useRef(false);
const isCompleted = useRef(false);
const isChamyoCanceled = useRef(false);
const isJoined = useRef(false);
const isOpened = useRef(false);

const kebabMenu = useMemo(() => {
if (role === 'MOIMER') {
return (
Expand All @@ -136,17 +129,13 @@ export default function MoimDetailPage() {
name: '모임 취소하기',
disabled: isPendingCancelMoim,
onClick: () => {
if (isMoimCanceled.current) return;
isMoimCanceled.current = true;
cancelMoim(moimId);
},
},
{
name: '모임 다시 열기',
disabled: isPendingReopenMoim,
onClick: () => {
if (isReopened.current) return;
isReopened.current = true;
ReopenMoim(moimId);
},
},
Expand All @@ -162,8 +151,6 @@ export default function MoimDetailPage() {
name: '참여 취소하기',
disabled: isPendingCancelChamyo,
onClick: () => {
if (isChamyoCanceled.current) return;
isChamyoCanceled.current = true;
cancelChamyo(moimId);
},
},
Expand Down Expand Up @@ -191,14 +178,10 @@ export default function MoimDetailPage() {

if (role === 'MOIMER') {
if (moim.status === 'MOIMING') {
if (isCompleted.current) return;
isCompleted.current = true;
return completeMoim(moimId);
}
if (moim.status === 'COMPLETED') {
if (moim.chatRoomId === null) {
if (isOpened.current) return;
isOpened.current = true;
return openChat(moimId);
}

Expand All @@ -208,8 +191,6 @@ export default function MoimDetailPage() {
}
if (role === 'NON_MOIMEE') {
if (moim.status === 'MOIMING') {
if (isJoined.current) return;
isJoined.current = true;
return joinMoim(moimId);
}
if (moim.status === 'COMPLETED') return;
Expand Down

0 comments on commit 7e9185b

Please sign in to comment.