hit endpoint

This commit is contained in:
counterweight 2025-02-25 17:09:20 +01:00
parent b3fe695ee5
commit 5eb1ad97b4
Signed by: counterweight
GPG key ID: 883EDBAA726BD96C

View file

@ -31,8 +31,8 @@ const lightningCheckbox = document.getElementById('lightning-checkbox');
const btcMethodCheckboxes = [onchainCheckbox, lightningCheckbox]; const btcMethodCheckboxes = [onchainCheckbox, lightningCheckbox];
const mytrustedCheckbox = document.getElementById('my-trusted-checkbox'); const myTrustedCheckbox = document.getElementById('my-trusted-checkbox');
const mytrustedtrustdCheckbox = document.getElementById( const myTrustedTrustedCheckbox = document.getElementById(
'my-trusted-trusted-checkbox' 'my-trusted-trusted-checkbox'
); );
const allMembersCheckbox = document.getElementById('all-members-checkbox'); const allMembersCheckbox = document.getElementById('all-members-checkbox');
@ -113,7 +113,7 @@ function validateBitcoinMethodCheckboxes(clickedCheckbox) {
} }
} }
function publishOffer() { async function publishOffer() {
let wants; let wants;
if (buyButton.classList.contains('selected')) { if (buyButton.classList.contains('selected')) {
wants = 'BTC'; wants = 'BTC';
@ -128,6 +128,9 @@ function publishOffer() {
const time_availability_details = timeInput.value; const time_availability_details = timeInput.value;
const is_onchain_accepted = onchainCheckbox.checked; const is_onchain_accepted = onchainCheckbox.checked;
const is_lightning_accepted = lightningCheckbox.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 are_big_notes_accepted = bigNotesAcceptedCheckbox.checked;
const offerDetails = { const offerDetails = {
@ -138,11 +141,19 @@ function publishOffer() {
time_availability_details, time_availability_details,
is_onchain_accepted, is_onchain_accepted,
is_lightning_accepted, is_lightning_accepted,
show_offer_to_trusted,
show_offer_to_trusted_trusted,
show_offer_to_all_members,
are_big_notes_accepted, 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', () => { buttonStartCreateOffer.addEventListener('click', () => {