Skip to content

Comments

✨ feat: cookie 활용해서 팀원전체보기 구현#23

Merged
soosooh merged 20 commits intomainfrom
feat/ci-cd
Jun 30, 2025
Merged

✨ feat: cookie 활용해서 팀원전체보기 구현#23
soosooh merged 20 commits intomainfrom
feat/ci-cd

Conversation

@soosooh
Copy link
Member

@soosooh soosooh commented Jun 30, 2025

User description

  • jwt cookie활용해서 로그인 코드 수정
  • 팀원 전체보기 코드 추가

PR Type

enhancement, configuration changes


Description

  • 로그인 및 팀원 전체보기 기능 구현

  • CI/CD 파이프라인 설정 추가

  • Dockerfile 생성 및 환경변수 설정

  • 팀원 평가 및 리포트 페이지 개선


Changes walkthrough 📝

Relevant files
Enhancement
5 files
actions.ts
로그인 액션 추가 및 리다이렉션 구현                                                                         
+29/-0   
page.tsx
팀원 데이터 API 호출 및 처리 구현                                                                       
+97/-11 
login-form.tsx
로그인 폼에서 API 호출 방식 변경                                                                         
+25/-21 
team-evaluation.tsx
팀원 평가 페이지 데이터 처리 개선                                                                           
+20/-61 
team-report.tsx
팀원 리포트 페이지 데이터 처리 개선                                                                         
+23/-68 
Configuration changes
2 files
ci.yml
CI/CD 워크플로우 설정 추가                                                                               
+80/-0   
Dockerfile
Dockerfile 생성 및 환경변수 설정                                                                   
+42/-0   

Need help?
  • Type /help how to ... in the comments thread for any questions about PR-Agent usage.
  • Check out the documentation for more information.
  • @idealHyun
    Copy link
    Contributor

    PR Reviewer Guide 🔍

    Here are some key observations to aid the review process:

    ⏱️ Estimated effort to review: 4 🔵🔵🔵🔵⚪
    🧪 No relevant tests
    🔒 No security concerns identified
    ⚡ Recommended focus areas for review

    Console Log Statements

    The code contains multiple console.log statements for debugging purposes. These should be removed or replaced with a proper logging mechanism before deploying to production.

    console.log('🔍 NEXT_PUBLIC_API_URL:', process.env.NEXT_PUBLIC_API_URL);
    console.log('🔍 요청 URL:', `${process.env.NEXT_PUBLIC_API_URL}/auth/login`);
    
    const res = await fetch(`${process.env.NEXT_PUBLIC_API_URL}/auth/login`, {
      method: 'POST',
      headers: { 'Content-Type': 'application/json' },
      body: JSON.stringify({ employeeNumber: userId, password }),
      credentials: 'include',
    });
    
    // 🔍 기본 응답 정보
    console.log('🔍 Status:', res.status, res.statusText);
    console.log('🔍 Headers:', Object.fromEntries(res.headers.entries()));
    
    const data = await res.json();
    
    if (!res.ok) {
      throw new Error(data.message || '로그인 실패');
    }
    
    console.log('🔍 Success Response:', data);
    Error Handling

    The function getEvaluationData throws errors when certain conditions are not met. Ensure that these errors are handled gracefully to avoid application crashes.

    async function getEvaluationData() {
      try {
        const cookieStore = await cookies();
        const accessToken = cookieStore.get('accessToken')?.value;
    
        if (!accessToken) throw new Error('accessToken 누락');
    
        const organizationId = extractOrganizationIdFromToken(accessToken);
        if (!organizationId) throw new Error('organizationId 추출 실패');
    
        const res = await fetch(
          `${process.env.NEXT_PUBLIC_API_URL}/quantitative-evaluation/${organizationId}`,
          {
            headers: {
              Authorization: `Bearer ${accessToken}`,
            },
            cache: 'no-store',
            credentials: 'include',
          }
        );
        console.log('accessToken', accessToken);
    
        if (!res.ok) throw new Error('API 요청 실패');
        return await res.json();
      } catch (error) {
        console.error(error);
        return { evaluated: false, users: [] };

    @idealHyun
    Copy link
    Contributor

    PR Description updated to latest commit (2f141b7)

    @idealHyun
    Copy link
    Contributor

    idealHyun commented Jun 30, 2025

    PR Code Suggestions ✨

    CategorySuggestion                                                                                                                                    Impact
    Possible issue
    응답 형식 검증 추가

    서버 응답이 JSON 형식이 아닐 경우를 대비해 res.json() 호출 전에 Content-Type 헤더를 확인하세요. JSON이 아닌 경우에는
    적절한 오류를 발생시켜야 합니다.

    app/login/actions.ts [17-23]

     console.log('🔍 Status:', res.status, res.statusText);
     console.log('🔍 Headers:', Object.fromEntries(res.headers.entries()));
    +
    +const contentType = res.headers.get('content-type');
    +if (!contentType || !contentType.includes('application/json')) {
    +  throw new Error('잘못된 응답 형식');
    +}
     
     const data = await res.json();
     
     if (!res.ok) {
       throw new Error(data.message || '로그인 실패');
     }
    Suggestion importance[1-10]: 8

    __

    Why: Adding a check for the Content-Type header before parsing the response as JSON enhances error handling and robustness, preventing potential runtime errors when the response is not in the expected format.

    Medium
    JSON 파싱 오류 처리 추가

    JSON.parse 호출 시 예외가 발생할 수 있으므로, 이를 try-catch 블록으로 감싸고 적절한 오류 메시지를 출력하세요.

    app/team/overview/page.tsx [34]

    -const decodedPayload = JSON.parse(Buffer.from(payloadBase64, 'base64').toString());
    +let decodedPayload;
    +try {
    +  decodedPayload = JSON.parse(Buffer.from(payloadBase64, 'base64').toString());
    +} catch (e) {
    +  console.error('JSON 파싱 실패:', e);
    +  return null;
    +}
    Suggestion importance[1-10]: 7

    __

    Why: Wrapping JSON.parse in a try-catch block improves error handling by catching potential parsing errors, which enhances the stability and reliability of the code.

    Medium

    @soosooh soosooh merged commit fd1a703 into main Jun 30, 2025
    1 check passed
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

    Projects

    None yet

    Development

    Successfully merging this pull request may close these issues.

    2 participants