From f878190d2e2273af8384c21d0cf2965ddbf43dbd Mon Sep 17 00:00:00 2001 From: Emithen <86219540+Emithen@users.noreply.github.com> Date: Sat, 17 Jan 2026 02:15:49 +0900 Subject: [PATCH 1/3] =?UTF-8?q?chore:=20=ED=83=88=ED=87=B4=ED=95=98?= =?UTF-8?q?=EA=B8=B0=20=EB=B2=84=ED=8A=BC=20=EB=8F=99=EC=9E=91=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/auth.ts | 8 ++++++++ src/components/pages/my/accountControlSection.tsx | 14 ++++++++++---- src/store/thunks/authThunks.ts | 12 +++++++++++- 3 files changed, 29 insertions(+), 5 deletions(-) diff --git a/src/api/auth.ts b/src/api/auth.ts index df62358..b85185f 100644 --- a/src/api/auth.ts +++ b/src/api/auth.ts @@ -33,3 +33,11 @@ export const logout = async () => { throw error } } + +export const signout = async () => { + try { + await authApi.post('/auth/withdraw') + } catch (error) { + throw error + } +} diff --git a/src/components/pages/my/accountControlSection.tsx b/src/components/pages/my/accountControlSection.tsx index 689772f..fd21f9f 100644 --- a/src/components/pages/my/accountControlSection.tsx +++ b/src/components/pages/my/accountControlSection.tsx @@ -1,5 +1,5 @@ import { useAppDispatch } from '@/hooks/utils/useAppDispatch' -import { logoutThunk } from '@/store/thunks/authThunks' +import { logoutThunk, signoutThunk } from '@/store/thunks/authThunks' export default function AccountControlSection() { const dispatch = useAppDispatch() @@ -8,14 +8,20 @@ export default function AccountControlSection() { dispatch(logoutThunk()) } + const handleSignout = () => { + dispatch(signoutThunk()) + } + return ( 계정 관리 - + 로그아웃 - - 탈퇴하기 + + + 탈퇴하기 + ) diff --git a/src/store/thunks/authThunks.ts b/src/store/thunks/authThunks.ts index e1f0bbd..9460ae2 100644 --- a/src/store/thunks/authThunks.ts +++ b/src/store/thunks/authThunks.ts @@ -9,7 +9,7 @@ import { AppDispatch } from '../store' import { getRefreshToken } from '@/utils/tokenUtils' import { saveTokens, clearTokens } from '@/utils/tokenUtils' import { reissue } from '@/api/auth' -import { logout as logoutApi } from '@/api/auth' +import { logout as logoutApi, signout as signoutApi } from '@/api/auth' import { login } from '@/api/auth' export const loginThunk = (code: string) => async (dispatch: AppDispatch) => { @@ -53,3 +53,13 @@ export const logoutThunk = () => async (dispatch: AppDispatch) => { throw err } } + +export const signoutThunk = () => async (dispatch: AppDispatch) => { + try { + await signoutApi() + dispatch(logout()) + clearTokens() + } catch (err) { + throw err + } +} From ec992e9c9a0526ec57c01541c139c39790567ea6 Mon Sep 17 00:00:00 2001 From: Emithen <86219540+Emithen@users.noreply.github.com> Date: Sat, 17 Jan 2026 02:31:03 +0900 Subject: [PATCH 2/3] =?UTF-8?q?chore:=20=EA=B6=8C=ED=95=9C=EC=9D=B4=20?= =?UTF-8?q?=EC=97=86=EB=8A=94=20=EB=8C=93=EA=B8=80=EC=97=90=EB=8A=94=20?= =?UTF-8?q?=EC=A1=B0=EC=9E=91=20UI=20=EB=85=B8=EC=B6=9C=20=EC=95=88=20?= =?UTF-8?q?=ED=95=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app/poll/[id]/page.tsx | 1 + .../pages/poll/Comment/commentDetail.tsx | 18 ++++++++++++------ 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/src/app/poll/[id]/page.tsx b/src/app/poll/[id]/page.tsx index 65772a8..9041f57 100644 --- a/src/app/poll/[id]/page.tsx +++ b/src/app/poll/[id]/page.tsx @@ -259,6 +259,7 @@ export default function PollDetailPage() { comments={comments} voteId={data.voteId} onClose={() => setOpen(false)} + profile={profile} /> )} {data && ( diff --git a/src/components/pages/poll/Comment/commentDetail.tsx b/src/components/pages/poll/Comment/commentDetail.tsx index af223bf..f8e2979 100644 --- a/src/components/pages/poll/Comment/commentDetail.tsx +++ b/src/components/pages/poll/Comment/commentDetail.tsx @@ -26,17 +26,20 @@ import { ModalBody, ModalFooter, } from '@/components/ui/modal' +import { Profile } from '@/types/member' interface CommentDetailProps { comments?: Comment[] voteId?: number | string onClose?: () => void + profile: Profile } const CommentDetail = ({ comments = [], voteId, onClose, + profile, }: CommentDetailProps) => { const [openReplies, setOpenReplies] = useState>({}) const [currentSort, setCurrentSort] = useState<'popular' | 'latest'>( @@ -294,12 +297,15 @@ const CommentDetail = ({ - toggleMenu(comment.commentId)} - > - - + {(profile.role === 'ADMIN' || + comment.nickname === profile.nickname) && ( + toggleMenu(comment.commentId)} + > + + + )} {openMenus[comment.commentId] && ( Date: Sun, 18 Jan 2026 17:50:03 +0900 Subject: [PATCH 3/3] =?UTF-8?q?chore:=20=EB=8C=93=EA=B8=80=20=EC=82=AD?= =?UTF-8?q?=EC=A0=9C=20refresh=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app/poll/[id]/page.tsx | 2 +- src/components/pages/poll/Comment/commentDetail.tsx | 7 +++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/app/poll/[id]/page.tsx b/src/app/poll/[id]/page.tsx index 9041f57..2231442 100644 --- a/src/app/poll/[id]/page.tsx +++ b/src/app/poll/[id]/page.tsx @@ -194,7 +194,7 @@ export default function PollDetailPage() { try { await deleteVote(data.voteId) setDeleteModalOpen(false) - router.back() + router.push('/balanse') } catch (error) { console.error('게시글 삭제 실패:', error) alert('게시글 삭제에 실패했습니다.') diff --git a/src/components/pages/poll/Comment/commentDetail.tsx b/src/components/pages/poll/Comment/commentDetail.tsx index f8e2979..9d7a47c 100644 --- a/src/components/pages/poll/Comment/commentDetail.tsx +++ b/src/components/pages/poll/Comment/commentDetail.tsx @@ -204,13 +204,12 @@ const CommentDetail = ({ const confirmDelete = async () => { const { commentId } = deleteConfirmModal - if (!commentId) return + if (!commentId || !voteId) return try { await deleteComment(commentId) - setLocalComments((prev) => - prev.filter((comment) => comment.commentId !== commentId), - ) + const response = await fetchComments(voteId, { sort: currentSort }) + setLocalComments(response.comments) setDeleteConfirmModal({ isOpen: false, commentId: null }) } catch (error) { console.error('댓글 삭제 실패:', error)