const Stand_list = { list: [], init: async () => { let html = await fetch('/lib/pages/stand/list/index.html').then((response) => response.text()); app.innerHTML = html; Stand_list.setHTML(); if (USER.possibilities.can_add_stand) { document.getElementById("buttons-list").style.display = "flex"; document.getElementById("constructorButton").style.display = ""; } }, loadAPI: async function (url) { const uuid = localStorage.getItem("uuid"); const response = await fetch(url, { method: 'GET', headers: { "Content-Type": "application/json", "Authorization": uuid } }); Stand_list.list = await response.json(); return Stand_list.list; }, setHTML: async function () { const block_list = document.getElementById('list'); const url = `${CONFIG.api}stand/list`; let list = this.list.length > 0 ? this.list : await this.loadAPI(url); let html = ""; for (const element of list) { html += this.renderCard({ element }); } block_list.innerHTML = html; }, renderCard: ({ element }) => { return `
`; }, }