Skip to content

Comments

refactor: 로그아웃시 alert 노출 문제 해결#393

Merged
Hyeonjun0527 merged 1 commit intomainfrom
refactor/logout
Feb 13, 2026
Merged

refactor: 로그아웃시 alert 노출 문제 해결#393
Hyeonjun0527 merged 1 commit intomainfrom
refactor/logout

Conversation

@Hyeonjun0527
Copy link
Member

@Hyeonjun0527 Hyeonjun0527 commented Feb 13, 2026

🌱 연관된 이슈

☘️ 작업 내용

작업 배경

로그아웃 직후(또는 비인증 요청) AUTH001 응답에서 토큰 재발급 로직이 실행되며
불필요한 alert가 노출되는 문제가 있었습니다.

주요 변경

  • refreshAccessToken 실패 catch에서 alert 제거, /login 리다이렉트만 수행
  • hasAuthToken 헬퍼 추가
    • accessToken 쿠키 또는 Authorization 헤더 존재 여부 확인
  • AUTH001 처리 시 인증 정보가 없으면 refresh를 시도하지 않고 즉시 에러 반환
  • 동일 로직을 V1/V2 axios 및 multipart 인터셉터에 모두 반영

변경 파일

  • src/api/client/axios.ts
  • src/api/client/axiosV2.ts

기대 효과

  • 로그아웃 직후 “토큰 갱신 실패” alert 미노출
  • 비회원 요청에서 불필요한 refresh API 호출 방지
  • 토큰 보유 사용자의 만료 케이스는 기존 refresh/retry 동작 유지

테스트 방법

  1. 로그인 후 로그아웃 직후 API 호출 시 alert가 뜨지 않는지 확인
  2. 비로그인 상태 AUTH001 응답 시 refresh 호출 없이 에러 처리되는지 확인
  3. 토큰 만료 상태(토큰 존재)에서 refresh 후 원요청 재시도가 정상 동작하는지 확인

🍀 참고사항

스크린샷 (선택)

Summary by CodeRabbit

릴리스 노트

  • 버그 수정

    • 인증 토큰 없이 요청할 때 불필요한 토큰 갱신 시도를 방지하도록 개선했습니다.
    • 인증 실패 시 로그인 페이지로 자동 리다이렉트됩니다.
  • 새로운 기능

    • 모집 기한이 지난 스터디는 '모집 마감' 버튼으로 표시됩니다.
    • URL 복사 성공/실패 결과를 토스트 알림으로 표시합니다.

@Hyeonjun0527 Hyeonjun0527 self-assigned this Feb 13, 2026
@vercel
Copy link

vercel bot commented Feb 13, 2026

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

Project Deployment Actions Updated (UTC)
study-platform-client-dev Ready Ready Preview, Comment Feb 13, 2026 7:31am

@Hyeonjun0527 Hyeonjun0527 changed the base branch from develop to main February 13, 2026 07:32
@coderabbitai
Copy link

coderabbitai bot commented Feb 13, 2026

📝 Walkthrough

워크스루

API 클라이언트 인터셉터에 인증 토큰 검증 헬퍼를 추가하여 토큰 갱신 시도를 방지하고, 에러 처리 로직을 개선했습니다. 또한 스터디 요약 컴포넌트에서 알림 창을 토스트 알림으로 대체하고 모집 마감 기한 검증 로직을 추가했습니다.

변경사항

Cohort / File(s) 요약
API 클라이언트 인터셉터
src/api/client/axios.ts, src/api/client/axiosV2.ts
인증 토큰 감지를 위한 hasAuthToken 헬퍼 함수 추가. AUTH001 에러 발생 시 토큰 갱신 전에 인증 토큰 확인 로직을 적용하여, 토큰이 없으면 즉시 ApiError로 거부. 토큰 갱신 실패 시 로그인으로 리다이렉트 처리.
스터디 요약 UI 컴포넌트
src/components/summary/study-info-summary.tsx
useToastStore 추가하여 alert 창을 토스트 알림으로 대체. 모집 마감 여부를 판단하는 isDeadlinePassed 로직 추가. 신청 버튼 비활성화 상태에 마감 여부 포함. 마감된 경우 버튼 텍스트를 '모집 마감'으로 변경.

예상 코드 리뷰 난이도

🎯 3 (보통) | ⏱️ ~20분

관련 가능성 있는 PR

🐰 토큰을 확인하고 스멀스멀,
마감된 모집은 차단하고,
알림은 토스트로 예쁘게 띄워~
인증과 기한, 모두 챙겼네!
사용자를 위한 따뜻한 배려 ✨

🚥 Pre-merge checks | ✅ 3 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed PR 제목은 로그아웃 시 alert 노출 문제 해결이라는 주요 변경 사항을 명확하게 요약하고 있습니다.
Merge Conflict Detection ✅ Passed ✅ No merge conflicts detected when merging into main

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch refactor/logout

No actionable comments were generated in the recent review. 🎉

🧹 Recent nitpick comments
src/api/client/axiosV2.ts (1)

90-102: hasAuthToken 및 인터셉터 로직 중복

axios.tsaxiosV2.tshasAuthToken 함수와 response 인터셉터 로직이 완전히 동일하게 중복되어 있습니다. 유지보수성을 위해 공통 유틸리티로 추출하는 것을 권장합니다.

♻️ 공통 유틸리티 추출 예시
// src/api/client/auth-utils.ts
import { InternalAxiosRequestConfig } from 'axios';
import { getCookie } from './cookie';

export const hasAuthToken = (requestConfig?: InternalAxiosRequestConfig): boolean => {
  const accessToken = getCookie('accessToken');
  if (accessToken) {
    return true;
  }

  const authorizationHeader = requestConfig?.headers?.Authorization;
  if (Array.isArray(authorizationHeader)) {
    return authorizationHeader.length > 0;
  }

  return Boolean(authorizationHeader);
};

이후 axios.tsaxiosV2.ts에서 import하여 사용할 수 있습니다.

Tip

Issue Planner is now in beta. Read the docs and try it out! Share your feedback on Discord.


Comment @coderabbitai help to get the list of available commands and usage tips.

@Hyeonjun0527 Hyeonjun0527 merged commit 2509c47 into main Feb 13, 2026
10 checks passed
@Hyeonjun0527 Hyeonjun0527 deleted the refactor/logout branch February 13, 2026 08:40
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