Skip to content

Commit

Permalink
fix: 카드 추가 후 다시 로드했을때, 직전의 카드 추가 내역이 반영되지 않는 이슈 개선
Browse files Browse the repository at this point in the history
  • Loading branch information
bytrustu committed Apr 10, 2024
1 parent 124425a commit 6caed7f
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/card/hooks/useLoadNearPayments.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ type UseLoadNearPaymentsProps = {
export const useLoadNearPayments = ({ clientId }: UseLoadNearPaymentsProps) => {
const overlay = useOverlay();
const cardStorageKey = `near-payments-${clientId}`;
const ownerCards = JSON.parse(localStorage.getItem(cardStorageKey) ?? '[]');

return ({ orderId, totalAmount, onPaymentComplete, onPaymentCancel }: PaymentForm) => {
if (!clientId || clientId.trim() === '') {
Expand All @@ -49,6 +48,8 @@ export const useLoadNearPayments = ({ clientId }: UseLoadNearPaymentsProps) => {
throw createError(ERROR_CODES.INVALID_AMOUNT);
}

const ownerCards = JSON.parse(localStorage.getItem(cardStorageKey) ?? '[]');

if (ownerCards.length > 0 && !ownerCards.every((card: any) => isValidateCardState(card))) {
throw createError(ERROR_CODES.INVALID_OWNER_CARDS);
}
Expand Down

0 comments on commit 6caed7f

Please sign in to comment.