diff --git a/src/components/Checkout/BasketItem.vue b/src/components/Checkout/BasketItem.vue index 3b07ab4cf1..2cc9d443d7 100644 --- a/src/components/Checkout/BasketItem.vue +++ b/src/components/Checkout/BasketItem.vue @@ -38,10 +38,10 @@ /> { + if (loan.loanId === this.loan.id) { + // Loan has a different team attribution, we should override the default + // Is team not in the users list, append it + if (!this.combinedTeams.some(team => team.id === loan.teamId)) { + this.appendedTeams.push({ + id: loan.teamId, + name: loan.teamName + }); + } + this.forceTeamId = loan.teamId; + } + }); + // Remove this loan from the cookie object after we've used it + teamChallengeLoanData.splice( + teamChallengeLoanData.findIndex(loan => loan.loanId === this.loan.id), + 1 + ); + // overwrite the cookie with the new data + this.cookieStore.set(teamChallengeCookieName, JSON.stringify(teamChallengeLoanData)); + } + } };