Skip to content

chore(teacher): 성공여부와 상관없이 리다이렉트 하게 변경#73

Open
hjy080530 wants to merge 2 commits intoproductfrom
bug/#71
Open

chore(teacher): 성공여부와 상관없이 리다이렉트 하게 변경#73
hjy080530 wants to merge 2 commits intoproductfrom
bug/#71

Conversation

@hjy080530
Copy link
Contributor

@hjy080530 hjy080530 commented Mar 3, 2026

📄 Summary

로그아웃하면 리다이렉트하게 만듭니당.


🔨 Tasks

  • 햇어욤

🙋🏻 More

Summary by CodeRabbit

  • 버그 수정
    • 로그아웃 동작을 개선하여 클라이언트상 세션 정보가 즉시 정리됩니다.
    • 서버 오류나 네트워크 문제와 관계없이 로그아웃 시 항상 메인 화면으로 이동해 사용자 경험이 일관되게 유지됩니다.

Copilot AI review requested due to automatic review settings March 3, 2026 13:58
@hjy080530 hjy080530 linked an issue Mar 3, 2026 that may be closed by this pull request
@vercel
Copy link
Contributor

vercel bot commented Mar 3, 2026

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

Project Deployment Actions Updated (UTC)
eodifront Ready Ready Preview, Comment Mar 3, 2026 2:49pm

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 3, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 98da59d and b6ab85b.

📒 Files selected for processing (2)
  • src/components/common/Header/NavItemList/NavItemList.tsx
  • src/stores/useAuthStore.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/stores/useAuthStore.ts

Walkthrough

로그아웃 흐름에서 정리(cleanup)와 상태 초기화 위치가 변경되고, logout API 오류 처리와 네비게이션 호출이 파일별로 조정되었습니다. 구체적으로: useAuthStore는 cleanup을 API 호출 전으로 옮기고 logout 오류를 무시하도록 catch를 추가했고, NavItemList는 라우트 이동을 finally로 보장하도록 변경되었습니다.

Changes

Cohort / File(s) Summary
Auth Store 변경
src/stores/useAuthStore.ts
로그아웃에서 액세스 토큰 확보 후 Storage.removeItem 및 상태 초기화 로직을 API 호출 이전으로 이동. try/catch로 변경되고, API 호출 실패를 잡는 빈 catch 블록(오류 무시)이 추가됨. finally 블록 제거.
헤더 네비게이션 변경
src/components/common/Header/NavItemList/NavItemList.tsx
handleLogout에서 logout 호출을 try { await logout() } finally { router.push(ROUTES.MAIN) }로 감싸 네비게이션이 성공/실패와 관계없이 항상 실행되도록 수정.

Sequence Diagram(s)

sequenceDiagram
    participant User as User (클릭)
    participant Nav as NavItemList
    participant Auth as useAuthStore
    participant Storage as Storage
    participant API as logoutApi
    participant Router as Router

    User->>Nav: 로그아웃 버튼 클릭
    Nav->>Auth: logout()
    Auth->>Storage: accessToken 확인 및 Storage.removeItem(), 상태 초기화
    Auth->>API: logoutApi(accessToken)
    API-->>Auth: (응답 또는 오류)
    Auth-->>Nav: 반환/종료
    Nav->>Router: router.push(ROUTES.MAIN) (finally)
Loading

(위 다이어그램은 변경된 흐름을 간단히 시각화합니다 — cleanup이 API 호출 이전에 수행되고, 네비게이션은 finally에서 항상 실행됩니다.)

예상 코드 리뷰 난이도

🎯 3 (Moderate) | ⏱️ ~20 minutes

🐰 토큰은 먼저 치우고,
호출은 살짝 던져버려요,
끝엔 길로 이끌리니,
당황 말고 홱! 🥕✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed PR 제목이 변경사항의 핵심을 명확하게 설명합니다. 로그아웃 후 성공 여부와 상관없이 리다이렉트하도록 변경한 내용이 파일 변경사항과 완벽하게 일치합니다.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

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

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch bug/#71

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

로그아웃 API 호출 성공 여부와 무관하게 클라이언트 인증 상태 정리(토큰 삭제/스토어 초기화)가 진행되도록 logout() 흐름을 조정한 변경입니다. 기존에는 logoutApi() 실패 시 finally는 실행되더라도 예외가 재전파되어 호출부에서 리다이렉트 등의 후속 처리가 끊길 수 있었는데, 이를 방지합니다.

Changes:

  • logoutApi() 실패를 catch에서 처리하여 logout()가 reject되지 않도록 변경
  • 실패 시 콘솔 에러 로그를 남기도록 추가

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/stores/useAuthStore.ts`:
- Around line 37-38: The catch block in the logout flow (in useAuthStore.ts —
the catch handling around the logout API call) currently logs the entire error
object to console which can expose sensitive request metadata; change the
handler to log only a sanitized message and non-sensitive fields (e.g.,
error.message or a trimmed string) or a fixed message, and forward the full
error to a secure monitoring system if needed; update the catch in the
logout/signOut function to replace console.error('로그아웃 API 호출 실패:', error) with
a safe log that avoids printing headers/tokens and includes only minimal
context.

ℹ️ Review info

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 6db9478 and 98da59d.

📒 Files selected for processing (1)
  • src/stores/useAuthStore.ts

Comment on lines +37 to +38
} catch (error) {
console.error('로그아웃 API 호출 실패:', error);
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

민감한 오류 객체를 그대로 콘솔에 출력하지 않는 것이 좋습니다.

Line 38에서 error 객체 전체를 로그로 남기면 브라우저 콘솔에 요청 메타데이터(예: 헤더/토큰 관련 정보)가 노출될 수 있습니다. 운영 환경에서는 정제된 메시지만 기록하도록 제한해 주세요.

🔧 제안 수정안
         } catch (error) {
-          console.error('로그아웃 API 호출 실패:', error);
+          if (process.env.NODE_ENV === 'development') {
+            console.error('로그아웃 API 호출 실패');
+          }
         } finally {
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
} catch (error) {
console.error('로그아웃 API 호출 실패:', error);
} catch (error) {
if (process.env.NODE_ENV === 'development') {
console.error('로그아웃 API 호출 실패');
}
} finally {
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/stores/useAuthStore.ts` around lines 37 - 38, The catch block in the
logout flow (in useAuthStore.ts — the catch handling around the logout API call)
currently logs the entire error object to console which can expose sensitive
request metadata; change the handler to log only a sanitized message and
non-sensitive fields (e.g., error.message or a trimmed string) or a fixed
message, and forward the full error to a secure monitoring system if needed;
update the catch in the logout/signOut function to replace console.error('로그아웃
API 호출 실패:', error) with a safe log that avoids printing headers/tokens and
includes only minimal context.

@hjy080530 hjy080530 self-assigned this Mar 3, 2026
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.

[버그] 로그아웃 리다이렉트

2 participants