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

[#69] 쿠폰 수정 & 삭제 API , 쿠폰 배너 API 구현 #79

Merged
merged 23 commits into from
Jan 23, 2024

Conversation

jinjoo-jung
Copy link
Collaborator

@jinjoo-jung jinjoo-jung commented Jan 22, 2024

close #69

Description

  • 쿠폰 삭제api 연결
  • 쿠폰 수정 api 작성 / 쿠폰 수정 모달 확인 클릭시 등록 페이지로 쿠폰넘버 쿼리스트링 값으로 이동
  • 쿠폰 toggle on/off api 연결
  • 쿠폰 배너 top3 api 연결
  • 쿠폰 OO구 지역 값 배너 보여주기
  • 모달 클릭 수정, 삭제 다르게 실행

유의할 점 및 ETC (Optional)

  • 쿠폰 api 정상적으로 잘 동작하는데 쿠폰 현재 서버 데이터 중에서 쿠폰 넘버가 중복된 것들이 있어서 삭제 해도 쿠폰이 남아있고 토글 on/off시 선택하지 않는 쿠폰 토글이 작동될 수도 있습니다..! ===> 해결 (정상작동 O)

스크린샷 (Optional)

스크린샷 2024-01-23 오전 12 11 18 스크린샷 2024-01-23 오전 12 12 13 스크린샷 2024-01-23 오전 12 12 22

Copy link

vercel bot commented Jan 22, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
cool-peace ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 23, 2024 5:49am
cool-peace-dev ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 23, 2024 5:49am

Copy link
Collaborator

@turkey-kim turkey-kim left a comment

Choose a reason for hiding this comment

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

고생많으셨습니다!


const CouponBanner = () => {
const headerAccommodation = useRecoilValue(headerAccommodationState);
const sigunguData = headerAccommodation.sigungu;
Copy link
Collaborator

Choose a reason for hiding this comment

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

이거 API없이 잘되었네요 👍..

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

맞아요 다행입니다 ㅎㅎ

Comment on lines +30 to +52

// 쿠폰 수정
export const useCouponUpdate = () => {
const queryClient = useQueryClient();
return useMutation<void, Error, CouponUpdateCredential>({
mutationFn: couponUpdateApi,
onSuccess: () => {
queryClient.invalidateQueries({ queryKey: ['CouponList'] });
}
});
};

// 쿠폰 삭제
export const useCouponDelete = () => {
const queryClient = useQueryClient();
return useMutation<void, Error, CouponDeleteCredential>({
mutationFn: couponDeleteApi,
onSuccess: () => {
queryClient.invalidateQueries({ queryKey: ['CouponList'] });
}
});
};

Copy link
Collaborator

Choose a reason for hiding this comment

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

저희 useQueryHook은 모두 분리하는 방식으로 하는게 좋을까요
아니면 이렇게 한 파일에서 관리하는게 좋을까요

Copy link
Collaborator

Choose a reason for hiding this comment

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

둘 다 상관없지만 시간이 괜찮으시다면 기존 컨벤션처럼 분리하는게 좋은 것 같습니당

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

넵 알겠습니다! 일단 머지한 후 현재 진행사항 마친 후 바로 분리 하겠습니다!!

Copy link
Collaborator

@dabin-Hailey dabin-Hailey left a comment

Choose a reason for hiding this comment

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

수고하셨습니다~!!

@@ -2,8 +2,15 @@ import styled from '@emotion/styled';
import theme from '@styles/theme';

import bannerIcon from '@assets/icons/ic-couponlist-speaker.svg';
import { useRecoilValue } from 'recoil';
Copy link
Collaborator

Choose a reason for hiding this comment

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

import { useRecoilValue } from 'recoil';

위 import는 상단으로 위치 이동해주시면 좋을 것같습니다!

Comment on lines +1 to +17
import {
CouponDeleteCredential,
CouponListResponse,
CouponToggleCredential,
CouponUpdateCredential
} from '@/types/couponList';
import {
useMutation,
useQueryClient,
useSuspenseQuery
} from '@tanstack/react-query';
import {
couponDeleteApi,
couponToggleApi,
couponUpdateApi,
getCouponList
} from 'src/api/lib/getCouponList';
Copy link
Collaborator

Choose a reason for hiding this comment

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

@tanstack/react-query

@/types/couponList
'src/api/lib/getCouponList

import 개행 부탁드립니다~

Comment on lines +2 to +10
if (conditionDays.length === 1) {
return `${conditionDays}요일`;
} else if (conditionDays === '평일') {
return '일~목';
} else if (conditionDays === '주말') {
return '금~토';
}
return conditionDays;
};
Copy link
Collaborator

Choose a reason for hiding this comment

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

N요일, 평일, 주말만 표현된다면 아래처럼 변경해보셔도 괜찮을 것같습니다!

if (conditionDays === '평일') {
  return '일~목';
} else if (conditionDays === '주말') {
  return '금~토';
}
return `${conditionDays}요일`;
};

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

앗 혹시 기본값은 전체로 와서 전체일 경우도 고려해서 작성한건데 다빈님 처럼 수정하는게 나을까요..?!

Copy link
Collaborator

Choose a reason for hiding this comment

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

제가 해당부분 인지를 정확히 하지 못하고있어서 그랬습니다 ㅜㅜ
전체 라는 값이 있다면 진주님 방식 그대로 해주시는게 더 좋을 것같습니다!!

status?: string,
title?: string
) =>
useSuspenseQuery<CouponListResponse, Error>({
Copy link
Member

Choose a reason for hiding this comment

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

쿼리 사용해서 잘 구현해주셨네요. 도움 많이 받고 갑니다 !

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

감사합니다!

@jinjoo-jung jinjoo-jung merged commit 33d6c7a into dev Jan 23, 2024
3 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.

[feat] 쿠폰 수정 / 삭제 API 구현
5 participants