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

[장바구니 협업 Step 1] 황펭(양이진) 미션 제출합니다. #83

Merged
merged 25 commits into from
May 26, 2023

Conversation

Leejin-Yang
Copy link

@Leejin-Yang Leejin-Yang commented May 25, 2023

배포주소

안녕하세요 티케! 저번 레벨 1때와 같이 마지막 미션에서 다시 만나서 반갑습니다 😊
이번 미션은 아커와 페어로 진행했습니다!
진행한 커밋 내역입니다. 링크에서 확인해주시면 됩니다.! 보러가기

상품 페이지 서버 변경 장바구니 페이지 서버 변경
products cart-items

요구 사항

  • 사용자는 여러 서버 중 하나를 선택할 수 있다.
  • 사용자 별 장바구니 기능이 정상적으로 동작하게 만든다.
    • 🚨 앱은 로컬에서 http 통신으로 동작하면 되며 https는 대응은 고려하지 않습니다.

백엔드 세명의 서버를 선택할 수 있게 select를 만들었습니다.
도치와 엔초 서버의 경우 https 처리가 되어있지 않아 배포 환경에서는 현재 푸우 서버에서만 정상 동작합니다.!

요청에 대한 전체적인 동작은 요약하면 다음과 같습니다.

  • post/patch/delete 요청
  • 응답 확인
    • 성공한 경우 setCartProduct
    • 실패한 경우 toast 메시지

장바구니 요청

백엔드 세개의 서버와 연결하면서 기존 cartProducState atom을 serverName을 받을 수 있게 recoil의 atomFamily로 변경해주었습니다.
그러다 보니 모든 selector가 selectorFamily로 변경되어 사용하는 모든 커스텀 훅에서 serverName이 구독하는 형태가 되었습니다.
더 복잡해지고 있다는 생각이 들어 비동기 과정을 useFetchCartProducts 커스텀 훅으로 분리하고 그 훅에서 serverName에 따라 요청을 보내고 setCartProduct 하게 수정했습니다. recoil에서 serverName은 받지 않아도 되었고 serverName은 해당 훅과 ErrorBoundary의 key로만 사용하도록 수정했습니다. 😊

그 밖에 진행한 과정

  • 장바구니 아이디를 장바구니 추가시 백엔드에서 보내주는 location에서 가져온 값으로 수정
  • 체크 상태 다루는 로직 수정
    • isChecked 값 수정 -> 배열에 CartProduct 추가 제거

Leejin-Yang and others added 25 commits May 23, 2023 17:12
Co-authored-by: 전증훈 <jeonjeunghoon@gmail.com>
Co-authored-by: 전증훈 <jeonjeunghoon@gmail.com>
Co-authored-by: 전증훈 <jeonjeunghoon@gmail.com>
Co-authored-by: 전증훈 <jeonjeunghoon@gmail.com>
Co-authored-by: 전증훈 <jeonjeunghoon@gmail.com>
Co-authored-by: 전증훈 <jeonjeunghoon@gmail.com>
Co-authored-by: 전증훈 <jeonjeunghoon@gmail.com>
Co-authored-by: 전증훈 <jeonjeunghoon@gmail.com>
Co-authored-by: 전증훈 <jeonjeunghoon@gmail.com>
Co-authored-by: 전증훈 <jeonjeunghoon@gmail.com>
Co-authored-by: 전증훈 <jeonjeunghoon@gmail.com>
Co-authored-by: 전증훈 <jeonjeunghoon@gmail.com>
Co-authored-by: 전증훈 <jeonjeunghoon@gmail.com>
Co-authored-by: 전증훈 <jeonjeunghoon@gmail.com>
Co-authored-by: 전증훈 <jeonjeunghoon@gmail.com>
Co-authored-by: 전증훈 <jeonjeunghoon@gmail.com>
Co-authored-by: 전증훈 <jeonjeunghoon@gmail.com>
Co-authored-by: 전증훈 <jeonjeunghoon@gmail.com>
Co-authored-by: 전증훈 <jeonjeunghoon@gmail.com>
Co-authored-by: 전증훈 <jeonjeunghoon@gmail.com>
Copy link

@devhyun637 devhyun637 left a comment

Choose a reason for hiding this comment

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

안녕하세요 황펭~ 티케입니다!
레벨1에서 만났는데 또 만나니 반갑네요~
저도 이번미션 잘부탁드립니다~

@devhyun637 devhyun637 merged commit 30b8057 into woowacourse:leejin-yang May 26, 2023
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