Skip to content

Develop#52

Merged
g-hyxn merged 2 commits intomainfrom
develop
Dec 30, 2025
Merged

Develop#52
g-hyxn merged 2 commits intomainfrom
develop

Conversation

@g-hyxn
Copy link
Collaborator

@g-hyxn g-hyxn commented Dec 30, 2025

💡 배경 및 개요

PR을 하게 된 문제상황, 배경 및 개요에 대해서 작성해주세요!

퍼블리싱의 경우 스크린샷/동영상도 추가해주면 좋아요!

Resolves: #{이슈번호}

📃 작업내용

PR에서 한 작업을 작성해주세요!

🙋‍♂️ 리뷰노트

구현 시에 고민이었던 점들 혹은 특정 부분에 대한 의도가 있었다면 PR 리뷰의 이해를 돕기 위해 서술해주세요!

또한 리뷰어에게 특정 부분에 대한 집중 혹은 코멘트 혹은 질문을 요청하는 경우에 작성하면 좋아요!

e.g. 작업을 끝내야할 시간이 얼마 없어 확장성보다는 동작을 위주로 만들었어요! 감안하고 리뷰해주세요!

✅ PR 체크리스트

템플릿 체크리스트 말고도 추가적으로 필요한 체크리스트는 추가해주세요!

  • 이 작업으로 인해 변경이 필요한 문서가 변경되었나요? (e.g. .env, 노션, README)
  • 이 작업을 하고나서 공유해야할 팀원들에게 공유되었나요? (e.g. "API 개발 완료됐어요", "환경값 추가되었어요")
  • 작업한 코드가 정상적으로 동작하나요?
  • Merge 대상 브랜치가 올바른가요?
  • PR과 관련 없는 작업이 있지는 않나요?

🎸 기타

@vercel
Copy link

vercel bot commented Dec 30, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
cklob-gami Ready Ready Preview, Comment Dec 30, 2025 5:15am

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @g-hyxn, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

이 PR은 관리자 게시글 삭제 기능의 사용자 인터페이스와 오류 처리 로직을 개선합니다. 기존의 단순한 window.confirm 대화 상자를 대신하여 전용 DeleteModal 컴포넌트를 도입하여 삭제 확인 과정을 명확하게 만들었습니다. 또한, 클라이언트 측 isAdmin 권한 확인 로직을 제거하고, 삭제 작업 중 발생할 수 있는 다양한 오류 상황에 대한 피드백을 사용자에게 더 상세하게 제공하도록 업데이트했습니다.

Highlights

  • 게시글 삭제 확인 모달 도입: 관리자 게시글 삭제 시 기존의 window.confirm 대신 전용 DeleteModal 컴포넌트를 사용하여 사용자 경험을 개선했습니다.
  • 클라이언트 측 isAdmin 함수 제거: 클라이언트에서 JWT 토큰을 파싱하여 관리자 권한을 확인하던 isAdmin 유틸리티 함수를 제거했습니다.
  • 오류 처리 개선: 게시글 삭제 실패 시 발생하는 다양한 오류(로그인 필요, 권한 없음, 게시글 없음, 서버 통신 오류)에 대해 더 구체적인 토스트 메시지를 제공하도록 handleAdminDelete 함수의 오류 처리 로직을 개선했습니다.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@g-hyxn g-hyxn merged commit 67b740a into main Dec 30, 2025
3 checks passed
Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

안녕하세요. PR을 리뷰했습니다.

게시글 삭제 시 window.confirm 대신 커스텀 DeleteModal을 사용하도록 변경하여 사용자 경험을 개선한 점이 좋습니다. 전반적으로 좋은 변화이지만, 몇 가지 중요한 개선점을 제안합니다.

  1. 삭제 버튼이 모든 사용자에게 노출되고 있습니다. 이는 관리자가 아닌 사용자에게 혼란을 줄 수 있으므로, 이전과 같이 관리자에게만 버튼이 보이도록 조건부 렌더링을 적용해야 합니다.
  2. API 요청 실패 시 에러 처리를 보강할 필요가 있습니다. 특히, 토큰 갱신 실패 시 발생하는 TokenRefreshError를 별도로 처리하여 사용자에게 재로그인이 필요함을 명확히 알려주는 것이 좋습니다.

자세한 내용은 각 파일의 주석을 확인해주세요.

Comment on lines 198 to 213
if (typeof error === 'object' && error !== null && 'response' in error) {
const status = (error as { response?: { status?: number } }).response
?.status;

if (status === 401) toast.error('로그인이 필요합니다.');
else if (status === 403) toast.error('관리자 권한이 없습니다.');
else if (status === 404) toast.error('게시글을 찾을 수 없습니다.');
else toast.error('게시글 삭제에 실패했습니다.');
if (status === 401) {
toast.error('로그인이 필요합니다.');
} else if (status === 403) {
toast.error('관리자 권한이 없습니다.');
} else if (status === 404) {
toast.error('게시글을 찾을 수 없습니다.');
} else {
toast.error('게시글 삭제에 실패했습니다.');
}
} else {
toast.error('서버와 통신할 수 없습니다.');
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

axios 인터셉터에서 토큰 갱신 실패 시 TokenRefreshError를 발생시키도록 구현되어 있습니다. 현재 catch 블록에서는 이 특정 오류를 처리하지 않고 일반적인 서버 통신 오류로 처리하고 있습니다. 토큰 갱신 실패는 사용자가 다시 로그인해야 하는 중요한 상황이므로, TokenRefreshError를 명시적으로 확인하여 사용자에게 재로그인이 필요함을 알리고 로그인 페이지로 리디렉션하는 등의 처리를 추가하는 것이 좋습니다.

TokenRefreshError를 사용하려면 파일 상단에서 import해야 합니다:

import { instance, TokenRefreshError } from '@/assets/shared/lib/axios';
      if (error instanceof TokenRefreshError) {
        toast.error('세션이 만료되었습니다. 다시 로그인해주세요.');
        // navigate('/login'); // 필요시 로그인 페이지로 리디렉션
        return;
      }

      if (typeof error === 'object' && error !== null && 'response' in error) {
        const status = (error as { response?: { status?: number } }).response
          ?.status;

        if (status === 401) {
          toast.error('로그인이 필요합니다.');
        } else if (status === 403) {
          toast.error('관리자 권한이 없습니다.');
        } else if (status === 404) {
          toast.error('게시글을 찾을 수 없습니다.');
        } else {
          toast.error('게시글 삭제에 실패했습니다.');
        }
      } else {
        toast.error('서버와 통신할 수 없습니다.');
      }
References
  1. API 인터셉터는 토큰 갱신 실패 시 에러를 던져야 하며, UI 계층은 이 에러를 처리하여 로그인 페이지로 리디렉션하는 등의 작업을 수행해야 합니다.

Comment on lines +353 to +358
<button
onClick={() => setIsDeleteModalOpen(true)}
className="cursor-pointer"
>
<Delete />
</button>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

관리자 여부를 확인하는 조건부 렌더링이 제거되어 모든 사용자에게 삭제 버튼이 표시됩니다. 이는 관리자가 아닌 사용자에게 혼란을 줄 수 있으며, 삭제 시도를 한 후에야 권한 없음 오류를 보게 되어 사용자 경험을 저해합니다.

이전처럼 관리자에게만 삭제 버튼이 보이도록 조건부 렌더링을 다시 추가하는 것을 고려해 보세요. 사용자 권한을 확인하는 로직(예: 사용자 정보를 담고 있는 context나 store 사용)을 사용하여 버튼의 노출 여부를 결정해야 합니다.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant