Skip to content

Commit

Permalink
Merge pull request #244 from lotteon2/develop
Browse files Browse the repository at this point in the history
[FIX] 모두다운로드 로직 복구 이후 위치조정
  • Loading branch information
CessnaJ authored Jan 20, 2024
2 parents 97aee3b + 4026158 commit bb37b99
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 19 deletions.
6 changes: 3 additions & 3 deletions src/apis/notification/notification.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +112,9 @@ export const subscribeToNotifications = (
// console.log('하트비트 외 모든 메세지 수신')
}

console.log('새로운 메세지가 도착했습니다.')
console.log(event.data)
console.log(event)
// console.log('새로운 메세지가 도착했습니다.')
// console.log(event.data)
// console.log(event)

onMessage(notification)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,15 +138,15 @@ const handleDownloadMultipleCoupons = async () => {
const downloadResponse: MultipleCouponDownloadResponse =
await downloadMultipleCoupons(downloadableCouponInfoIds)
// 다운로드 된 쿠폰들 상태변경
coupons.value = coupons.value.map((coupon) => {
coupons.value.forEach((coupon, index) => {
// 다운로드 된 쿠폰들 상태변경
if (downloadResponse.successfulIds.includes(coupon.couponInfoId)) {
return { ...coupon, isDownloadable: false } // 상태 업데이트
coupons.value[index].isDownloadable = false
}
return coupon
})
console.log('다운로드된 couponInfoId 목록:', downloadResponse.successfulIds)
console.log('다운로드 실패한 couponInfoId 목록:', downloadResponse.failedIds)
// console.log('다운로드된 couponInfoId 목록:', downloadResponse.successfulIds)
// console.log('다운로드 실패한 couponInfoId 목록:', downloadResponse.failedIds)
await successModal(
'알림',
Expand All @@ -170,28 +170,28 @@ const maxDiscountAmount = computed(() => {
for (const coupon of coupons.value) {
let discountAmount = 0
console.log(`임시 discountAmount 초기화:${discountAmount}`)
// console.log(`임시 discountAmount 초기화:${discountAmount}`)
// 할인 타입에 따라 분기
if (coupon.discountType === 'PERCENTAGE') {
discountAmount = (productPriceValue * coupon.discountValue) / 100
console.log(`PERCENTAGE:${coupon}`)
console.log(`discountAmount:${discountAmount}`)
// console.log(`PERCENTAGE:${coupon}`)
// console.log(`discountAmount:${discountAmount}`)
} else if (coupon.discountType === 'FIXED_AMOUNT') {
discountAmount = coupon.discountValue
console.log(`FIXED_AMOUNT:${coupon}`)
console.log(`discountAmount:${discountAmount}`)
// console.log(`FIXED_AMOUNT:${coupon}`)
// console.log(`discountAmount:${discountAmount}`)
}
// maxDiscountAmount가 있다면 해당 쿠폰 할인이 해당 limit을 안넘는지 확인
discountAmount = Math.min(discountAmount, coupon.maxDiscountAmount ?? Infinity)
console.log(`max처리 후 임시 discountAmount:${discountAmount}`)
// console.log(`max처리 후 임시 discountAmount:${discountAmount}`)
// max값 갱신
maxDiscount = Math.max(maxDiscount, discountAmount)
console.log(`갱신 후 임시 maxDiscount:${maxDiscount}`)
// console.log(`갱신 후 임시 maxDiscount:${maxDiscount}`)
}
console.log(`최종 계산완료 된 maxDiscount:${maxDiscount}`)
// console.log(`최종 계산완료 된 maxDiscount:${maxDiscount}`)
emit('best-promotional-price-updated', maxDiscount) // computed로 변경시 emit
Expand Down
4 changes: 2 additions & 2 deletions src/stores/notification/NotificationStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ export const useNotificationStore = defineStore(
}

const subscribeToNotificationsHandler = () => {
console.log('subscribeToNotificationsHandler를 발동')
// console.log('subscribeToNotificationsHandler를 발동')

if (!shouldSubscribeToSSE.value) {
// orderSuccessView에서 SSE연결을 하지 않게 제어. 뒤로가기 누를 수 있으니 사이드이펙트 방지용으로 1회성 차단으로 설정
Expand All @@ -109,7 +109,7 @@ export const useNotificationStore = defineStore(

eventSourceUnsubscribe = notificationApi.subscribeToNotifications(
(notification: Notification) => {
console.log('구독 후 의미있는 알림을 받았습니다.')
// console.log('구독 후 의미있는 알림을 받았습니다.')
// console.log('토스트 알림을 띄웁니다.')
notifications.value.unshift(notification)
unreadNotificationCount.value++
Expand Down

0 comments on commit bb37b99

Please sign in to comment.