diff --git a/src/public/javascript/offers.js b/src/public/javascript/offers.js index 921bab6..3a73d12 100644 --- a/src/public/javascript/offers.js +++ b/src/public/javascript/offers.js @@ -31,8 +31,8 @@ const lightningCheckbox = document.getElementById('lightning-checkbox'); const btcMethodCheckboxes = [onchainCheckbox, lightningCheckbox]; -const mytrustedCheckbox = document.getElementById('my-trusted-checkbox'); -const mytrustedtrustdCheckbox = document.getElementById( +const myTrustedCheckbox = document.getElementById('my-trusted-checkbox'); +const myTrustedTrustedCheckbox = document.getElementById( 'my-trusted-trusted-checkbox' ); const allMembersCheckbox = document.getElementById('all-members-checkbox'); @@ -113,7 +113,7 @@ function validateBitcoinMethodCheckboxes(clickedCheckbox) { } } -function publishOffer() { +async function publishOffer() { let wants; if (buyButton.classList.contains('selected')) { wants = 'BTC'; @@ -128,6 +128,9 @@ function publishOffer() { const time_availability_details = timeInput.value; const is_onchain_accepted = onchainCheckbox.checked; const is_lightning_accepted = lightningCheckbox.checked; + const show_offer_to_trusted = myTrustedCheckbox.checked; + const show_offer_to_trusted_trusted = myTrustedTrustedCheckbox.checked; + const show_offer_to_all_members = allMembersCheckbox.checked; const are_big_notes_accepted = bigNotesAcceptedCheckbox.checked; const offerDetails = { @@ -138,11 +141,19 @@ function publishOffer() { time_availability_details, is_onchain_accepted, is_lightning_accepted, - + show_offer_to_trusted, + show_offer_to_trusted_trusted, + show_offer_to_all_members, are_big_notes_accepted, }; - console.log(offerDetails); + await fetch('/api/offer', { + method: 'POST', + headers: { + 'Content-Type': 'application/json', + }, + body: JSON.stringify({ offerDetails }), + }); } buttonStartCreateOffer.addEventListener('click', () => {