Skip to content
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

[Feat] 추첨 이벤트 API 연동 #113

Merged
merged 17 commits into from
Aug 7, 2024
Merged

[Feat] 추첨 이벤트 API 연동 #113

merged 17 commits into from
Aug 7, 2024

Conversation

jhj2713
Copy link
Member

@jhj2713 jhj2713 commented Aug 7, 2024

🖥️ Preview

2024-08-07.5.47.59.mov

close #96

✏️ 한 일

  • 캐스퍼 목록 보기 API 연동
  • 인증 토큰 발급 API 연동
  • 응모 정보 조회 API 연동
  • 캐스퍼 봇 생성 API 연동
  • 캐스퍼 이벤트 조회 API 연동

❗️ 발생한 이슈 (해결 방안)

토큰 저장 방식

토큰을 어디에 저장하는게 좋을지 고민이 많이 됐습니다. 후보가 세 개가 있었는데,

1. Context API
context API의 경우 브라우저에 저장되는 것이 아니라 상태로서 저장되는 것이기 때문에 다른 storage에 비해 안전합니다. 하지만 새로고침 하면 데이터가 삭제되기 때문에 이를 유지하기 위해서는 또다른 저장소를 활용해야했기 때문에 굳이 Context API를 사용할 필요는 없다고 생각했습니다.

2. localStorage
브라우저에 저장되는 정보로 새로고침을 해도 데이터가 유지되고 get/set이 편리합니다. 하지만 브라우저에 존재하는 값이고, JS로 접근이 가능하기 때문에 공격에 취약할 수 있습니다. 토큰 정보를 담기에는 취약한 저장소라 생각해서 사용하지 않기로 했습니다.

3. Cookie
쿠키는 localStorage 처럼 브라우저에 저장되는 key value 쌍입니다. localStorage와 차이점은 JS로 접근이 불가능하기 때문에 XSS(Cross-Site Scripting) 공격에서 안전합니다.

-> Cookie를 사용해서 토큰을 저장하기로 했습니다.

❓ 논의가 필요한 사항

@jhj2713 jhj2713 added the feat 기능 구현 label Aug 7, 2024
@jhj2713 jhj2713 requested a review from sooyeoniya August 7, 2024 08:59
@jhj2713 jhj2713 self-assigned this Aug 7, 2024
Copy link
Member

@sooyeoniya sooyeoniya left a comment

Choose a reason for hiding this comment

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

드디어 API 연동됐군요!!
완전 멋집니다 ㅎㅎ 저두 분발할게용 🥸

Comment on lines +94 to +109
<AnimatePresence>
<motion.ul
ref={containerRef}
className="flex"
animate={transitionControls}
style={{ gap: `${gap}px` }}
onUpdate={(latest) => {
if (isEndCard(parseInt(String(latest.x)))) {
startAnimation(initialX);
}
}}
>
{cardList.map((card) => renderCardItem(card, `${card.id}`))}
{cardList.map((card) => renderCardItem(card, `${card.id}-clone`))}
</motion.ul>
</AnimatePresence>
Copy link
Member

Choose a reason for hiding this comment

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

AnimatePresence는 안써봤는데 한 번 공부해봐야겠군여..

@sooyeoniya sooyeoniya merged commit 4466a9a into dev Aug 7, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feat 기능 구현
Projects
None yet
Development

Successfully merging this pull request may close these issues.

추첨 이벤트 - 캐스퍼 API 연동
2 participants