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] 최근 본 상품, 구매하기 버튼 동작 구현 #163

Merged
merged 7 commits into from
Aug 2, 2024

Conversation

ggjiny
Copy link
Contributor

@ggjiny ggjiny commented Jul 19, 2024

🚀 작업 내용

  • 최근 본 상품 api 연결
  • 구매하기 버튼 눌렀을 때 동작 구현

📝 참고 사항

  • 헤더에 프로필 이미지 null인 경우 추가

🖼️ 스크린샷

🚨 관련 이슈 (이슈 번호)

✅ 체크리스트

  • Code Review 요청
  • Label 설정
  • PR 제목 규칙에 맞는지 확인

@ggjiny ggjiny added 📖 Page 페이지 제작 📬 API 서버 api 통신 labels Jul 19, 2024
@ggjiny ggjiny self-assigned this Jul 19, 2024
@ggjiny ggjiny linked an issue Jul 19, 2024 that may be closed by this pull request
Copy link
Contributor

@bokeeeey bokeeeey left a comment

Choose a reason for hiding this comment

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

LGTM !

src/api/productAPI.ts Outdated Show resolved Hide resolved
src/api/productAPI.ts Show resolved Hide resolved
@@ -85,7 +85,7 @@ export default function Header() {
<SearchButton isBlack={isBlack} />
{!users ? <LoginButton onClick={handleLoginButtonClick} /> : <LogoutButton />}
<button className={cn('user-icon')} type='button' onClick={handleUserIconClick}>
{profileImage ? (
{profileImage && profileImage !== 'null' ? (
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
{profileImage && profileImage !== 'null' ? (
{profileImage && profileImage != null ? (

요즘 자바스크립트 공부하면서 드는 생각인데 이런식으로 null이 문자열로 넘어오는 경우에는 동치연산자 말고 동등 연산자로 사용해도 좋을거같아요
물론 컴포넌트 수정할때 제가 고려하지 못한 부분이지만.. 암튼

Copy link
Contributor Author

Choose a reason for hiding this comment

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

해봤는데 인식을 못해요ㅜㅜ

Copy link
Contributor

@Young2un Young2un left a comment

Choose a reason for hiding this comment

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

예진님 화이띵~!!!

thumbnail={thumbnail}
reviewscount={reviewCount}
isLiked={liked}
category={category}
hasShop={false}
Copy link
Contributor

Choose a reason for hiding this comment

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

이거 제가 옵셔널로 바꿔서 이제 false면 안적어도 될꺼에용! 이름이 같은건 ...rest로 할 수 없나요? ㅠ 진짜 프롭스가 넘 많네용,, 제가 만든 부분이라 제가 고민해봐야 할 거 같아요,,

Copy link
Contributor Author

Choose a reason for hiding this comment

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

hasShop 말씀하시는걸까용?? 옵셔널로 안되어있는데..!! isLiked는 하트 버튼때문에 대부분 다 필요할거에요!?

Copy link
Contributor

@armd482 armd482 left a comment

Choose a reason for hiding this comment

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

수고하셨습니다~!

const handleClickBuyButton = () => {
checkUserAndOptions();
if (checkUserAndOptions()) return;
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
if (checkUserAndOptions()) return;
if (checkUserAndOptions()) {
return;
}

Comment on lines +160 to +161
setCookie('orderId', response.data.toString());
router.push(ROUTER.MY_PAGE.CHECKOUT);
Copy link
Contributor

Choose a reason for hiding this comment

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

orderId 쿠키에 저장하기로 했었나요...?(정말 기억 안남😆)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

넵넵~~!!

Comment on lines +192 to 194
if (userData?.data && productId) {
addRecentProduct(productId);
}
Copy link
Contributor

Choose a reason for hiding this comment

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

useEffect로 mutation 불러오는 게 개인적으로는 살짝 위험하다고 생각합니다(dependency 관련),
이 부분은 상점 페이지에서 해당 상품을 클릭했을 때 mutation 발생시키는 건 어떨지 제안해봅니다!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

좋은 것 같은데 그럼 productlist나 productitem에서 onclick이벤트가 필요한데 지금 둘 다 서버 컴포넌트로 되어있어서🥹 고민을 좀 해봐야겠네요우...

Copy link
Contributor

@armd482 armd482 Jul 31, 2024

Choose a reason for hiding this comment

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

클라이언트 컴포넌트도 서버에서 prerender되기 때문에, prerender때 seo에 필요한 내용들은 반영되도록 하면 클라이언트 컴포넌트로 해도 큰 문제 없을 것 같아요

Copy link
Contributor

@minjeong9919 minjeong9919 left a comment

Choose a reason for hiding this comment

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

고생하셨습니닷 👍 리뷰가 증말 늦었군뇨,,, 다른 분들이 좋은 리뷰 많이 달아주셔서 추가할 리뷰는 없었던 것 같아요옹

price: number;
category: 'switch' | 'keyboard' | 'keycap' | 'etc';
reviewCount: number;
liked: boolean;
Copy link
Contributor

Choose a reason for hiding this comment

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

isLiked는 어떠신가용

@ggjiny ggjiny merged commit a9c5419 into develop Aug 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
📬 API 서버 api 통신 📖 Page 페이지 제작
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feat] 최근 본 상품 api연결
5 participants