-
Notifications
You must be signed in to change notification settings - Fork 1
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
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
고생하셨습니다!
src/recoil/atoms/couponListState.ts
Outdated
import { CouponLitResponse } from '@/types/couponList'; | ||
import { atom } from 'recoil'; |
There was a problem hiding this comment.
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';
src/types/couponList.ts
Outdated
@@ -10,43 +10,48 @@ export interface CategoryTabStyleProps { | |||
$categoryTab: boolean; | |||
} | |||
|
|||
// api 데이터 타입 | |||
// api 쿠폰 리스트정보 응답 데이터 | |||
export interface CouponLitResponse { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CouponLitResponse 오타인 것 같습니다!
CouponListResponse
accommodationId: number, | ||
date?: string, | ||
status?: string, | ||
title?: string |
There was a problem hiding this comment.
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;
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
분리하였습니다!! 감사합니다 !
src/api/lib/getCouponList.ts
Outdated
const params = { | ||
date: date, | ||
status: status, | ||
title: title | ||
}; |
There was a problem hiding this comment.
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
}
src/api/lib/getCouponList.ts
Outdated
const result = await instance.get(`/v1/coupons/${accommodationId}`, { | ||
params | ||
}); | ||
return result.data; |
There was a problem hiding this comment.
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;
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
넵 좋은 것 같습니다 수정했습니다!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
수고하셨습니당~!!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
수고 많으셨습니다! 컨벤션 잘 지켜주셔서 가독성이 높네요
close #51
Description
유의할 점 및 ETC (Optional)
스크린샷 (Optional)
2024-01-21.12.39.24.mov
전체 카테고리
노출 ON
노출 OFF
만료
검색
(객실리스트)