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

[#51] 쿠폰 조회 API 연결 #68

Merged
merged 24 commits into from
Jan 21, 2024
Merged

[#51] 쿠폰 조회 API 연결 #68

merged 24 commits into from
Jan 21, 2024

Conversation

jinjoo-jung
Copy link
Collaborator

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

close #51

Description

  • 쿠폰 조회 api 구현
  • 전역상태인 accommodationId 값을 가져와서 api 요청에 사용하였습니다
  • 전체/노출 ON/ 노출 OFF/ 만료 + 등록일 기준(1년/ 6개월/3개월) + 검색 클릭 조건에 맞춰서 쿠폰 조회되도록 구현
  • 받아오는 쿠폰 리스트 recoil 전역으로 상태관리
  • 쿠폰 register_room_numbers 배열의 길이가 0이면 전체 / 0이상 이면 일부객실 리스트 처리
  • 카테고리 수 데이터 가져오기

유의할 점 및 ETC (Optional)

  • 이후 react-query로 api 코드 수정할 예정입니다.
  • 쿠폰 nav , main 컴포넌트에서 쿠폰상태관리가 필요하며 쿠폰 수정을 위해서 전역으로 쿠폰 리스트 정보를 관리하였습니다.
  • 추가 api 작업 이후 console.log 지울 예정입니다

스크린샷 (Optional)

2024-01-21.12.39.24.mov

전체 카테고리

스크린샷 2024-01-21 오전 12 45 18

노출 ON

스크린샷 2024-01-21 오전 12 45 26

노출 OFF

스크린샷 2024-01-21 오전 12 48 16

만료

스크린샷 2024-01-21 오전 12 45 33

검색

스크린샷 2024-01-21 오전 12 45 48

(객실리스트)
스크린샷 2024-01-21 오전 12 45 56

Copy link

vercel bot commented Jan 20, 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 21, 2024 8:05am
cool-peace-dev ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 21, 2024 8:05am

Copy link
Collaborator

@JitHoon JitHoon left a comment

Choose a reason for hiding this comment

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

고생하셨습니다!

Comment on lines 1 to 2
import { CouponLitResponse } from '@/types/couponList';
import { atom } 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 { atom } from 'recoil';

import { CouponLitResponse } from '@/types/couponList';

@@ -10,43 +10,48 @@ export interface CategoryTabStyleProps {
$categoryTab: boolean;
}

// api 데이터 타입
// api 쿠폰 리스트정보 응답 데이터
export interface CouponLitResponse {
Copy link
Collaborator

Choose a reason for hiding this comment

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

CouponLitResponse 오타인 것 같습니다!
CouponListResponse

Comment on lines +5 to +8
accommodationId: number,
date?: string,
status?: string,
title?: string
Copy link
Collaborator

Choose a reason for hiding this comment

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

타입을 분리하면 좋을 것 같습니다!

export interface GetCouponListProps {
  accommodationId: number;
  date?: string;
  status?: string;
  title?: string;
}

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 10 to 14
const params = {
date: date,
status: status,
title: title
};
Copy link
Collaborator

Choose a reason for hiding this comment

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

아래와 같이 작성해도 동작에 무리없을 것 같습니다!
객체의 key 와 value 값이 같다면, property shorthand

const params = {
    data,
    status,
    title
}

Comment on lines 16 to 19
const result = await instance.get(`/v1/coupons/${accommodationId}`, {
params
});
return result.data;
Copy link
Collaborator

Choose a reason for hiding this comment

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

다빈님이 api를 받아오는 변수로 response를 사용하셨는데, 변수명을 response로 통일하는 건 어떠신가요?

const response = await instance.get(`/v1/coupons/${accommodationId}`, {
    params
  });
  return response.data;
}

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.

수고하셨습니당~!!

@jinjoo-jung jinjoo-jung merged commit 6dbdfdc into dev Jan 21, 2024
3 checks passed
Copy link
Member

@jiohjung98 jiohjung98 left a comment

Choose a reason for hiding this comment

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

수고 많으셨습니다! 컨벤션 잘 지켜주셔서 가독성이 높네요

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 구현
4 participants