-
Notifications
You must be signed in to change notification settings - Fork 0
[Hotfix] 서버 에러 알림 모달 제거 #194
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Walkthrough
Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant JoinPage
participant GoogleAuthServer
User->>JoinPage: "Google로 로그인" 버튼 클릭
JoinPage->>JoinPage: handleGoogleLogin() 호출
JoinPage->>GoogleAuthServer: window.location.href로 리디렉션
GoogleAuthServer-->>User: 인증 페이지 표시
Possibly related PRs
Poem
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ESLint
apps/web/src/app/join/Join.tsxOops! Something went wrong! :( ESLint: 9.17.0 Error [ERR_MODULE_NOT_FOUND]: Cannot find package '@repo/eslint-config' imported from /eslint.config.mjs ✨ Finishing Touches
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
apps/web/src/app/join/Join.tsx(2 hunks)
🔇 Additional comments (1)
apps/web/src/app/join/Join.tsx (1)
8-8: useModal 훅 제거 승인useModal 훅의 import가 제거되었고 컴포넌트 내에서 더 이상 사용되지 않는 것을 확인했습니다. 불필요한 의존성 제거로 코드가 깔끔해졌습니다.
| const handleGoogleLogin = async () => { | ||
| //window.location.href = process.env.NEXT_PUBLIC_GOOGLE_AUTH_URL ?? ''; | ||
| modal.alert({ | ||
| title: '서버 점검 중', | ||
| description: | ||
| '5/30(금) 오전 1시에 완료될 예정이에요\n이용에 불편을 드려 죄송해요', | ||
| alertButton: '확인', | ||
| isCloseOnDimmerClick: false, | ||
| }); | ||
| window.location.href = process.env.NEXT_PUBLIC_GOOGLE_AUTH_URL ?? ''; | ||
| }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Google 로그인 함수 개선 필요
함수가 단순화되었지만 몇 가지 개선이 필요합니다:
- 환경 변수 검증:
NEXT_PUBLIC_GOOGLE_AUTH_URL이 undefined일 때 빈 문자열로 리디렉션하면 예상치 못한 동작이 발생할 수 있습니다. - async 키워드 불필요: 더 이상 비동기 작업을 수행하지 않으므로 async 키워드가 불필요합니다.
다음과 같이 개선하는 것을 권장합니다:
- const handleGoogleLogin = async () => {
- window.location.href = process.env.NEXT_PUBLIC_GOOGLE_AUTH_URL ?? '';
- };
+ const handleGoogleLogin = () => {
+ const googleAuthUrl = process.env.NEXT_PUBLIC_GOOGLE_AUTH_URL;
+ if (!googleAuthUrl) {
+ toast.error('로그인 서비스에 일시적인 문제가 발생했습니다.');
+ return;
+ }
+ window.location.href = googleAuthUrl;
+ };📝 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.
| const handleGoogleLogin = async () => { | |
| //window.location.href = process.env.NEXT_PUBLIC_GOOGLE_AUTH_URL ?? ''; | |
| modal.alert({ | |
| title: '서버 점검 중', | |
| description: | |
| '5/30(금) 오전 1시에 완료될 예정이에요\n이용에 불편을 드려 죄송해요', | |
| alertButton: '확인', | |
| isCloseOnDimmerClick: false, | |
| }); | |
| window.location.href = process.env.NEXT_PUBLIC_GOOGLE_AUTH_URL ?? ''; | |
| }; | |
| const handleGoogleLogin = () => { | |
| const googleAuthUrl = process.env.NEXT_PUBLIC_GOOGLE_AUTH_URL; | |
| if (!googleAuthUrl) { | |
| toast.error('로그인 서비스에 일시적인 문제가 발생했습니다.'); | |
| return; | |
| } | |
| window.location.href = googleAuthUrl; | |
| }; |
🤖 Prompt for AI Agents
In apps/web/src/app/join/Join.tsx around lines 23 to 25, the handleGoogleLogin
function uses an async keyword unnecessarily and redirects to an empty string if
the environment variable NEXT_PUBLIC_GOOGLE_AUTH_URL is undefined, which can
cause unexpected behavior. Remove the async keyword since there are no
asynchronous operations, and add a check to ensure NEXT_PUBLIC_GOOGLE_AUTH_URL
is defined before setting window.location.href; if it is undefined, handle the
case appropriately, such as showing an error or avoiding redirection.
| alertButton: '확인', | ||
| isCloseOnDimmerClick: false, | ||
| }); | ||
| window.location.href = process.env.NEXT_PUBLIC_GOOGLE_AUTH_URL ?? ''; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Verification agent
🧩 Analysis chain
환경 변수 설정 확인 요청
Google 인증 URL 환경 변수가 올바르게 설정되었는지 확인이 필요합니다. 환경 변수가 없을 경우 사용자에게 적절한 오류 메시지를 제공하는 것이 좋겠습니다.
다음 스크립트로 환경 변수 설정을 확인해주세요:
🏁 Script executed:
#!/bin/bash
# Description: 환경 변수 NEXT_PUBLIC_GOOGLE_AUTH_URL 설정 확인
# .env 파일들에서 NEXT_PUBLIC_GOOGLE_AUTH_URL 검색
fd -e env -x grep -l "NEXT_PUBLIC_GOOGLE_AUTH_URL" {} \;
# 환경 변수 사용처 검색
rg "NEXT_PUBLIC_GOOGLE_AUTH_URL" --type typescript --type javascriptLength of output: 163
다음 스크립트로 .env* 파일과 코드 전체에서 NEXT_PUBLIC_GOOGLE_AUTH_URL 설정 및 사용처를 다시 확인해주세요:
🏁 Script executed:
#!/bin/bash
# .env 파일(.env, .env.local 등)에서 NEXT_PUBLIC_GOOGLE_AUTH_URL 검색
rg --files-with-matches -g ".env*" "NEXT_PUBLIC_GOOGLE_AUTH_URL"
# 코드 전체에서 NEXT_PUBLIC_GOOGLE_AUTH_URL 사용처 검색 (ts, tsx, js, jsx)
rg "NEXT_PUBLIC_GOOGLE_AUTH_URL" -t ts -t tsx -t js -t jsxLength of output: 300
.env 파일과 코드 전체를 숨김 파일 및 다양한 확장자까지 포함해 다시 검색해 보겠습니다:
🏁 Script executed:
#!/bin/bash
# 숨김 파일(.env*) 검색 포함
rg --hidden --files-with-matches --glob ".env*" "NEXT_PUBLIC_GOOGLE_AUTH_URL"
# 코드 전체 검색: ts, tsx, js, jsx 확장자 포함
rg --hidden --files-with-matches \
--glob "*.ts" \
--glob "*.tsx" \
--glob "*.js" \
--glob "*.jsx" \
"NEXT_PUBLIC_GOOGLE_AUTH_URL"Length of output: 378
❗ NEXT_PUBLIC_GOOGLE_AUTH_URL 환경 변수 정의 및 에러 처리 추가 요청
현재 apps/web/src/app/join/Join.tsx 에서만 process.env.NEXT_PUBLIC_GOOGLE_AUTH_URL 을 참조하고 있으며, 레포지토리에 해당 키를 정의한 .env* 파일은 보이지 않습니다. 또한 환경 변수가 없을 때 빈 문자열로 바로 window.location.href 를 설정하고 있어 사용자 경험(UX)이 부정확해질 수 있습니다.
수정 제안:
.env,.env.local등 설정 파일에NEXT_PUBLIC_GOOGLE_AUTH_URL이 정의되어 있는지 확인하고, 없다면 추가해주세요.- 환경 변수가 없을 때 사용자에게 알림 메시지를 표시하거나 로그인 버튼을 비활성화하는 등 명시적인 에러 처리를 구현해주세요.
예시 코드 스니펫:
- window.location.href = process.env.NEXT_PUBLIC_GOOGLE_AUTH_URL ?? '';
+ const googleAuthUrl = process.env.NEXT_PUBLIC_GOOGLE_AUTH_URL;
+ if (!googleAuthUrl) {
+ // TODO: 사용자에게 오류 메시지 표시
+ console.error('환경 변수 NEXT_PUBLIC_GOOGLE_AUTH_URL이 설정되지 않았습니다.');
+ return;
+ }
+ window.location.href = googleAuthUrl;- 파일:
apps/web/src/app/join/Join.tsx - 위치: 24행
📝 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.
| window.location.href = process.env.NEXT_PUBLIC_GOOGLE_AUTH_URL ?? ''; | |
| const googleAuthUrl = process.env.NEXT_PUBLIC_GOOGLE_AUTH_URL; | |
| if (!googleAuthUrl) { | |
| // TODO: 사용자에게 오류 메시지 표시 | |
| console.error('환경 변수 NEXT_PUBLIC_GOOGLE_AUTH_URL이 설정되지 않았습니다.'); | |
| return; | |
| } | |
| window.location.href = googleAuthUrl; |
🤖 Prompt for AI Agents
In apps/web/src/app/join/Join.tsx at line 24, the code sets window.location.href
to process.env.NEXT_PUBLIC_GOOGLE_AUTH_URL or an empty string without checking
if the environment variable is defined. To fix this, first ensure that
NEXT_PUBLIC_GOOGLE_AUTH_URL is properly defined in your .env or .env.local
files. Then, update the code to check if this environment variable exists before
redirecting; if it is missing, display an appropriate error message to the user
or disable the login button to prevent navigation to an invalid URL.
This reverts commit cfe416d.
관련 이슈
서버 에러 알림 모달을 제거합니다.
변경 사항
레퍼런스
Summary by CodeRabbit