Skip to content

fix: 인터뷰 페이지에서 공통된 API 콜 하도록 수정 #1643

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

Merged
merged 2 commits into from
May 7, 2025

Conversation

jaeyeonling
Copy link
Contributor

이 풀 리퀘스트는 InterviewPage 컴포넌트에서 API 호출 방식을 리팩터링하여 각 파일마다 새로운 Axios 인스턴스를 생성하는 대신 중앙 집중화된 client 모듈을 사용하도록 변경했습니다. 또한, InterviewSetup에서 조건문 로직과 에러 처리에 대한 소폭 개선도 포함되어 있습니다.

API 리팩터링:

  • InterviewSessionInterviewSetup 컴포넌트(frontend/src/pages/InterviewPage/InterviewSession.tsx, frontend/src/pages/InterviewPage/InterviewSetup.tsx)에서 로컬로 정의된 Axios 인스턴스(api)를 공유 client 모듈로 교체했습니다. [[1]] [[2]]
  • InterviewSession에서 /answers, /restart, /quit 등의 엔드포인트에 대한 모든 API 호출을 client.post로 변경했습니다. [[1]] [[2]] [[3]]
  • InterviewSetup에서 /sessions/mine, /missions, /questions, /interviews 등의 엔드포인트에 대해 client.getclient.post를 사용하도록 API 호출을 업데이트했습니다. [[1]] [[2]] [[3]] [[4]]

로직 및 에러 처리 개선:

  • InterviewSetupselectedSessionselectedMission에 대한 조건문을 단순화하여 중복 코드를 줄였습니다. [[1]] [[2]]
  • InterviewSetuphandleStartInterview 함수에서 selectedSessionselectedMission에 대한 추가 유효성 검사를 포함시키고, 인터뷰 시작 실패 시 알림 메시지를 추가했습니다.
  • InterviewSetup 및 InterviewSession에서 로컬 Axios 인스턴스를 src/apis의 공유 'client'로 교체했습니다.
  • 이 변경은 API 요청의 유지보수성과 일관성을 향상시킵니다.

- Replaced local Axios instances in InterviewSetup and InterviewSession
  with the shared 'client' from src/apis.
- This improves maintainability and consistency in API requests.
Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Hello @jaeyeonling, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

Summary of Changes

This pull request focuses on refactoring the API call structure within the InterviewPage component. Instead of creating new Axios instances in each file, it centralizes API calls through a shared client module. Additionally, there are minor improvements to conditional logic and error handling in InterviewSetup. Specifically, the local Axios instances in InterviewSetup.tsx and InterviewSession.tsx have been replaced with the shared 'client' from src/apis.

Highlights

  • API Refactoring: The pull request replaces locally defined Axios instances in InterviewSession and InterviewSetup with a shared client module from src/apis.
  • Logic and Error Handling: The pull request simplifies conditional statements for selectedSession and selectedMission in InterviewSetup and adds validation and error messaging to handleStartInterview.

Changelog

  • frontend/src/pages/InterviewPage/InterviewSession.tsx
    • Replaced local Axios instance with client from ../../apis (lines 3, 199, 223, 243).
    • Updated API calls for /answers, /restart, and /quit endpoints to use client.post (lines 199, 223, 243).
  • frontend/src/pages/InterviewPage/InterviewSetup.tsx
    • Replaced local Axios instance with client from ../../apis (line 3).
    • Simplified conditional logic for fetching missions and questions (lines 213, 232).
    • Updated API calls for /sessions/mine, /missions, /questions, and /interviews to use client.get and client.post (lines 197, 216, 235, 265).
    • Added validation for selectedSession, selectedMission, and selectedQuestion in handleStartInterview (line 260).
    • Added error alert when interview start fails (line 279).
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in issue comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist is currently in preview and may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments to provide feedback.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.


A common client,
For API's ascent,
Code made more clean,
A joy to be seen,
Bugs now transient.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request refactors the API calling logic in the InterviewPage component to use a centralized client module instead of creating new Axios instances in each file. It also includes minor improvements to conditional logic and error handling in InterviewSetup. Overall, the changes improve maintainability and consistency.

Summary of Findings

  • Redundant conditional logic: The original code in InterviewSetup.tsx had redundant conditional logic for handling selectedSession and selectedMission. The refactored code simplifies these conditions, improving readability and reducing potential errors.
  • Centralized API client: The pull request replaces local Axios instances with a shared client module from src/apis. This change promotes consistency and simplifies API request management across the application.
  • Improved error handling: The handleStartInterview function in InterviewSetup.tsx now includes additional validation for selectedSession, selectedMission, and selectedQuestion, and displays an alert message if the interview fails to start. This enhances the user experience by providing more informative feedback.

Merge Readiness

The pull request is well-structured and addresses the issue of inconsistent API calls effectively. The improvements to error handling and conditional logic enhance the robustness and maintainability of the code. I recommend merging this pull request after addressing the comments provided. I am unable to directly approve the pull request, and recommend that others review and approve this code before merging.

@woowahan-neo woowahan-neo merged commit be51858 into main May 7, 2025
1 of 2 checks passed
@woowahan-neo woowahan-neo deleted the fix/standardize-api-client branch May 7, 2025 08:50
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