fe can read from back
This commit is contained in:
parent
9e2af37158
commit
0e0a094dc8
3 changed files with 48 additions and 2 deletions
|
|
@ -172,6 +172,50 @@ async function publishOffer() {
|
|||
toggleCreateOfferControls();
|
||||
}
|
||||
|
||||
class Offer {
|
||||
constructor(offerData) {
|
||||
this.uuid = offerData.uuid;
|
||||
this.public_key = offerData.public_key;
|
||||
this.wants = offerData.wants;
|
||||
this.premium = offerData.premium;
|
||||
this.trade_amount_eur = offerData.trade_amount_eur;
|
||||
this.location_details = offerData.location_details;
|
||||
this.time_availability_details = offerData.time_availability_details;
|
||||
this.show_offer_to_trusted = offerData.show_offer_to_trusted;
|
||||
this.show_offer_to_trusted_trusted =
|
||||
offerData.show_offer_to_trusted_trusted;
|
||||
this.show_offer_to_all_members = offerData.show_offer_to_all_members;
|
||||
this.is_onchain_accepted = offerData.is_onchain_accepted;
|
||||
this.is_lightning_accepted = offerData.is_lightning_accepted;
|
||||
this.are_big_notes_accepted = offerData.are_big_notes_accepted;
|
||||
this.created_at = offerData.created_at;
|
||||
this.last_updated_at = offerData.last_updated_at;
|
||||
}
|
||||
}
|
||||
|
||||
class MyOffers {
|
||||
constructor() {
|
||||
this.offers = [];
|
||||
}
|
||||
|
||||
async getOffersFromApi() {
|
||||
const offersResponse = await fetch('/api/publickey-offers');
|
||||
|
||||
if (!offersResponse.ok) {
|
||||
this.offers = [];
|
||||
}
|
||||
|
||||
const offersData = (await offersResponse.json()).data;
|
||||
if (offersResponse.ok) {
|
||||
for (const record of offersData) {
|
||||
this.offers.push(new Offer(record));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
async render() {}
|
||||
}
|
||||
|
||||
buttonStartCreateOffer.addEventListener('click', () => {
|
||||
toggleCreateOfferControls();
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue