Додана сторінка "Стенд"

Додане повідомлення про оновлення застосунку
Оновлен Service Worker
Перероблен WebSocket APІ
This commit is contained in:
2025-10-19 00:55:30 +03:00
parent 6ec6523d71
commit 3f08f3f6c9
46 changed files with 2651 additions and 2691 deletions

View File

@@ -1,6 +1,53 @@
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 `
<div class="card">
<div class="contents">
<div class="info">
<div>
<p>${element.title}</p>
</div>
</div>
</div>
<a href="/stand/card/${element.id}" data-route></a>
</div>
`;
},
}