Skip to content

Commit

Permalink
Merge pull request #25 from TLI-Group-1/fix/claim-button-upon-search
Browse files Browse the repository at this point in the history
Fixclaim button upon every search search
  • Loading branch information
Shalev-Lifshitz authored Dec 13, 2021
2 parents 9a2bf26 + 50b8d81 commit 3c4b4a0
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion js/discover.js
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,15 @@ function displayCarsOrOffers(listings) {
item['term_mo'],
item['total_sum']
);

// check to see if the offer is claimed
if (item['claimed'] === true) {
// set the claim button to claimed
let claimButton = document.querySelector(
'button.claim-btn[name="' + item['offer_id'] + '"]'
);
toggleButtonClaimed(claimButton);
}
}

// if there is an odd number of cars, add an invisible entry for visual pleasantness
Expand Down Expand Up @@ -445,7 +454,7 @@ async function toggleClaimOffer(id) {
await api.unclaimOffer(userID, id);
}

// display the offer details
// set the claim button to claimed
toggleButtonClaimed(claimButton);

// update the claimed offers widget, fetch and display the user's claimed offers
Expand Down

0 comments on commit 3c4b4a0

Please sign in to comment.