[쿠폰] 버튼 처리 및 retcode 0 아닐떄 처리

- 다운로드 쿠폰이 아니면 다운로드 버튼 노출 및 다운 안되도록 변경
 - 전체 다운로드시 retcode0 아닐때 노출 처리.
This commit is contained in:
junghoon86.park
2025-11-18 18:22:47 +09:00
parent c05a241d4e
commit 2f5a99444d
2 changed files with 38 additions and 27 deletions

View File

@@ -38,11 +38,21 @@ export const getProductCouponTotDownload = (props) => (dispatch, getState) => {
const onSuccess = (response) => {
console.log("getProductCouponTotDownload onSuccess ", response.data);
dispatch({
type: types.GET_PRODUCT_COUPON_TOTDOWNLOAD,
payload: response.data.data,
});
if(response.data.retCode === 0){
dispatch({
type: types.GET_PRODUCT_COUPON_TOTDOWNLOAD,
payload: response.data.data,
});
} else {
dispatch(
showError(
response.data.retCode,
response.data.retMsg,
false,
response.data.retDetailCode
)
);
}
};
const onFail = (error) => {

View File

@@ -366,7 +366,7 @@ export default function ProductAllSection({
dispatch(
getProductCouponDownload({ mbrNo: userNumber, cpnSno: cpnSno })
);
};
};
return (
<SpottableComponent
@@ -375,7 +375,7 @@ export default function ProductAllSection({
{...rest}
onFocus={() => onFocus(index)}
onBlur={onBlur}
onClick={handleDownloadClick}
onClick={downloadYn === "N" ? null : handleDownloadClick}
>
<div
className={css.couponItem}
@@ -412,26 +412,27 @@ export default function ProductAllSection({
</span>
</div>
<div
className={classNames(
css.couponBottomButton,
downloadCouponArr.length > 0 &&
downloadCouponArr.includes(cpnSno) &&
css.disable,
downloadYn === "N" && css.disable,
duplDwldYn === "N" && downloadYn === "Y" && css.disable,
!downloadCouponArr.includes(cpnSno) &&
index === selectedCouponIndex &&
focused &&
css.focused
)}
aria-label="Download Button"
>
{downloadCouponArr.length > 0 &&
downloadCouponArr.includes(cpnSno)
? $L("DOWNLOAD COMPLETED")
: $L("DOWNLOAD")}
</div>
{downloadYn !== "N" && (
<div
className={classNames(
css.couponBottomButton,
downloadCouponArr.length > 0 &&
downloadCouponArr.includes(cpnSno) &&
css.disable,
duplDwldYn === "N" && downloadYn === "Y" && css.disable,
!downloadCouponArr.includes(cpnSno) &&
index === selectedCouponIndex &&
focused &&
css.focused
)}
aria-label="Download Button"
>
{downloadCouponArr.length > 0 &&
downloadCouponArr.includes(cpnSno)
? $L("DOWNLOAD COMPLETED")
: $L("DOWNLOAD")}
</div>
)}
</div>
</SpottableComponent>
);