/** * Component to render data for not conserved assets sheet * @class NotConservedSheet */ export class NotConservedSheet { /** * @param {object} data */ set siteData(data) { this._data = data; } async render() { return `

Denominazione: ${this._data.denomination}

Periodo: ${this._data.period}

Località generica: ${this._data.genericLocation}

Descrizione
${this._data.shortDescription}

Bibliografia: ${await this.biblio(this._data.id)}

Autore scheda: ${this._data.author}

`; } async biblio(recordId) { let record = await this.fetchData(`${window.API_URL}/not_conserved/${recordId}`); let biblio = ''; if (record.bibliography.length) { record.bibliography.forEach(record => { biblio += ` ${record.citation.toLowerCase()}, ${record.pages}; `; }); } return biblio.trim().slice(0, -1); } async fetchData(url) { return await fetch(url).then(res => res.json()); } }