Skip to content

Commit

Permalink
Merge pull request #255 from lotteon2/develop
Browse files Browse the repository at this point in the history
[FIX] props deconstruct 해제
  • Loading branch information
CessnaJ authored Jan 21, 2024
2 parents af2973f + 358aef2 commit 6e84fcc
Showing 1 changed file with 26 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,26 @@ const emit = defineEmits([
'best-promotional-price-updated'
])
const { showModal, productId, categoryId, productPriceValue } = defineProps({
// const { showModal, productId, categoryId, productPriceValue } = defineProps({
// showModal: {
// type: Boolean,
// required: true
// },
// productId: {
// type: Number,
// required: true
// },
// categoryId: {
// type: Number,
// required: true
// },
// productPriceValue: {
// type: Number,
// required: true
// }
// })
const props = defineProps({
showModal: {
type: Boolean,
required: true
Expand All @@ -85,25 +104,25 @@ const { showModal, productId, categoryId, productPriceValue } = defineProps({
}
})
const productPrice = ref(productPriceValue) // Using the prop value
const productPrice = ref(props.productPriceValue) // Using the prop value
const coupons = ref<CouponInfoItemWithAvailabilityResponse[]>([])
onMounted(async () => {
// 로그인 여부에 따라 axios intance 종류 분기
if (!localStorage.getItem('accessToken')) {
try {
coupons.value = await getCouponsWithAvailibilityForProductDetailNotLoggedIn(
productId,
categoryId
props.productId,
props.categoryId
)
} catch (error) {
console.error('Failed to fetch coupons for product detail:', error)
}
} else {
try {
coupons.value = await getCouponsWithAvailibilityForProductDetailLoggedIn(
productId,
categoryId
props.productId,
props.categoryId
)
} catch (error) {
console.error('Failed to fetch coupons for product detail:', error)
Expand Down Expand Up @@ -174,7 +193,7 @@ const maxDiscountAmount = computed(() => {
// 할인 타입에 따라 분기
if (coupon.discountType === 'PERCENTAGE') {
discountAmount = (productPriceValue * coupon.discountValue) / 100
discountAmount = (props.productPriceValue * coupon.discountValue) / 100
// console.log(`PERCENTAGE:${coupon}`)
// console.log(`discountAmount:${discountAmount}`)
} else if (coupon.discountType === 'FIXED_AMOUNT') {
Expand Down

0 comments on commit 6e84fcc

Please sign in to comment.