Skip to content

Commit 038cead

Browse files
Merge pull request #290 from Front-line-dev/fix/mix-card
fix: μΉ΄λ“œκ°€ μ•ˆ λ°›μ•„μ‘Œμ–΄λ„ λ‚˜μ€‘μ— λ‹€μ‹œ λ°›κ²Œ 함
2 parents 04d9051 + a1ac948 commit 038cead

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

β€Žsrc/frontend/utils/CardManager.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,21 @@ const CardManager = class {
4646
}
4747

4848
updateCardInformation(cardIDs) {
49+
const cardQuantityDifference = cardIDs.length - this.submittedCards.length;
50+
51+
if (cardQuantityDifference > 0) {
52+
Array.from({ length: cardQuantityDifference }).forEach(() =>
53+
this.dropNewCard(),
54+
);
55+
}
56+
57+
if (cardQuantityDifference < 0) {
58+
this.submittedCards
59+
.slice(0, -cardQuantityDifference)
60+
.forEach((card) => card.delete());
61+
this.submittedCards = this.submittedCards.slice(-cardQuantityDifference);
62+
}
63+
4964
this.submittedCards.forEach((card, idx) =>
5065
card.setCardInformation(cardIDs[idx]),
5166
);

0 commit comments

Comments
Β (0)