Skip to content

Commit

Permalink
fix: 하드코딩 된 couponId params 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
xodms0309 committed Jun 4, 2023
1 parent 4d9fe95 commit b871f01
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
10 changes: 6 additions & 4 deletions src/api/requests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,12 @@ export const getDeliveryPolicy = async (server: string) => {
return data;
};

export const getCouponApplied = () => async (server: string) => {
const data = await api.get(`${server}/cart-items/coupons?id=1,2,3`);
return data;
};
export const getCouponApplied =
(couponIds: number[]) => async (server: string) => {
const params = couponIds.join(',');
const data = await api.get(`${server}/cart-items/coupons?id=${params}`);
return data;
};

export const postPayments =
(payload: PostPaymentRequest) => async (server: string) => {
Expand Down
2 changes: 1 addition & 1 deletion src/components/Cart/PaymentDetail/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const PaymentDetail = () => {
const { request } = useMutate();

const { data } = useGet<CouponAppliedPriceResponse>(
getCouponApplied(),
getCouponApplied(couponIds),
couponIds
);

Expand Down

0 comments on commit b871f01

Please sign in to comment.