-
Notifications
You must be signed in to change notification settings - Fork 12
[7주차] Team 하니홈 신수진 & 원채영 미션 제출합니다. #5
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
Open
chaeyoungwon
wants to merge
127
commits into
CEOS-Developers:master
Choose a base branch
from
suyoungSwim:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
environment: 초기 개발 환경 세팅
### 🔥 작업 내용 - ClientWrapper 생성 -> 새로고침 시 재발급 API 호출하여 토큰 저장 구현
gustn99
pushed a commit
to Loopz-Official/next-vote-21th
that referenced
this pull request
Jun 28, 2025
…-page-ui: 투표 페이지 UI 구현 Feat: 투표 페이지 UI 구현
gustn99
pushed a commit
to Loopz-Official/next-vote-21th
that referenced
this pull request
Jun 28, 2025
gustn99
pushed a commit
to Loopz-Official/next-vote-21th
that referenced
this pull request
Jun 28, 2025
…-page-ui: 투표 페이지 UI 구현 Feat: 투표 페이지 UI 구현
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
배포 링크
하니홈 투표 배포 링크 🔗
피그마 디자인 링크
하니홈 투표 UI 🔗
과제를 하며
주어진 필수 구현 사항을 바탕으로 전체 UI를 디자인한 후, 이를 기준으로 파트를 나누었는데요. 유사한 UI끼리 묶어서 한 명은 홈, 로그인, 회원가입 페이지를, 다른 한 명은 멤버 페이지, 투표 페이지, 공통 모달을 맡기로 한 후, 사다리타기를 통해 역할을 정했습니다.
신수진: 프로젝트 세팅, 투표 페이지, 멤버 페이지, 공통 모달
[7주차 작업 내용]
BE
,FE
객체로 분리 저장하였고, 투표 페이지와 멤버 페이지에서 각 파트에 따라 URL 파라미터(params.part
)를 사용하여 데이터를 동적으로 불러오는 구조로 구현하였습니다.onClose
와onConfirm
두 개의 핸들러로 분리하여 역할 명확화하였습니다. 아니오(onClose
)를 눌렀을 때 모달이 닫히고, 예(onConfirm
)를 눌렀을 때 로직 실행 또는 페이지 이동 처리하였습니다. 재사용 가능한 컴포넌트로 설계하여 다른 투표 유형에서도 활용 가능하도록 구성하였습니다.[8주차 작업 내용]
원채영: UI 디자인, 공통 레이아웃, 홈, 로그인, 회원가입
[7주차 작업 내용]
[8주차 작업 내용]
7주차에 받은 코드 리뷰를 바탕으로 전반적으로 코드를 리팩토링하고 깨지는 UI들을 수정하였습니다.
홈 화면에 총 투표 수를 함수로 받아오며, 실시간으로 숫자가 올라가는 애니메이션을 추가하여 훅으로 구현하였습니다.
zod와 react-hook-form을 함께 사용하여 회원가입 시 거치는 유효성 검사 코드, 추론 코드 등을 개발하였습니다.
이메일 및 아이디 중복 검사 API를 연결하여 회원가입 시 모든 입력과 API 연결에 성공하였을 경우 회원가입 버튼이 활성화되도록 조건을 추가했습니다.
토큰 관리 방식을 구체화하고, 실제 로그인 및 회원가입, 로그아웃 API를 연결하였습니다.
현재 백엔드에서는 토큰 만료 시 자동으로 재발급해주는 로직이 구현되어 있습니다.
하지만 프론트엔드에서 Zustand를 사용해 토큰을 저장할 경우, 페이지를 새로고침하면 토큰이 초기화되는 문제가 발생합니다. 이를 해결하기 위해, 백엔드에 API 개발을 요청하여 페이지가 새로고침될 때 토큰 재발급 API를 호출하는 로직을 추가하였습니다.
단, 사용자가 직접 로그아웃을 실행한 경우에는 재발급이 이루어지지 않도록 하기 위해, 로컬스토리지에 특정 값을 저장해 해당 상황을 구분하도록 처리했습니다..
middleware.ts에서 일반적으로 사용자 접근 제어를 처리하지만, 토큰을 메모리에 저장하고 있어
쿠키에 저장된 리프레시 토큰의 존재 여부를 기반으로 로그인 여부를 판단하고자 했습니다. 하지만 도메인 불일치 등의 이유로 쿠키가
undefined
로 전달되는 문제가 발생한 것으로 보였고,, 클라이언트 측에서 별도의 인증 훅을 작성하여 로그인 여부를 판단하고, 필요한 경우 라우팅을 제한하는 방식으로 처리하였습니다 ㅠㅅㅠ투표 결과를 득표순으로 정렬되어 있는 API가 따로 존재하여 기존에 연결해둔 API를 제거하고 해당 API로 대체하였습니다. 또한 중복되는 API 연결 로직을 하나로 통일하고, fetch로 연결되어 있던 API들은 axiosInstance를 사용하는 형태로 전반적으로 수정하였습니다.
Key Question
Zod 스키마가 무엇인지, 어떻게 활용할 수 있는지 알아봅시다.
Zod
는 런타임에서의 타입 검증과 스키마 기반 유효성 검사를 지원하는 TypeScript 친화적 라이브러리import { z } from "zod";
사용 이유: TypeScript는 컴파일 타임에만 타입을 검사할 수 있다. 하지만 실제 코드가 동작하는 시점은 런타임이며, 이때 잘못된 값이 들어오더라도 TS는 관여할 수 없다.
age
가string
이어도 실제 런타임에서는 에러 없이 통과할 수 있음Zod를 쓰면 이런 상황에서 런타임 검증이 가능
활용 예시
이번 프로젝트에서 토큰 관리를 어떻게 할 예정인지, 그리고 왜 그런 방법을 선택했는지에 대해 설명해 주세요.