Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 3 additions & 10 deletions apps/web/src/app/join/Join.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,13 @@ import * as styles from './page.css';
import InsteadLogoImage from '@web/assets/images/instead.svg';
import { Spacing } from '@repo/ui/Spacing';
import JoinImage from '@web/assets/images/join.png';
import { useToast, useModal } from '@repo/ui/hooks';
import { useToast } from '@repo/ui/hooks';
import { useEffect } from 'react';
import { Text } from '@repo/ui/Text';
import { GoogleLoginButton } from './_components/GoogleLoginButton/GoogleLoginButton';

export default function JoinPage() {
const toast = useToast();
const modal = useModal();

useEffect(() => {
const params = new URLSearchParams(window.location.search);
Expand All @@ -22,15 +21,9 @@ export default function JoinPage() {
}, [toast]);

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 ?? '';
Copy link

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 javascript

Length 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 jsx

Length 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.

Suggested change
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.

};
Comment on lines 23 to 25
Copy link

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Google 로그인 함수 개선 필요

함수가 단순화되었지만 몇 가지 개선이 필요합니다:

  1. 환경 변수 검증: NEXT_PUBLIC_GOOGLE_AUTH_URL이 undefined일 때 빈 문자열로 리디렉션하면 예상치 못한 동작이 발생할 수 있습니다.
  2. 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.

Suggested change
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.


return (
<div className={styles.wrapper}>
<Image
Expand Down
Loading