transaction

This commit is contained in:
2025-01-20 00:12:30 +03:00
parent 1ffa0581bf
commit 485c11de5f
16 changed files with 589 additions and 1 deletions

View File

@ -2,6 +2,14 @@
text-align: center;
}
#btnBox {
margin-bottom: 10px;
}
#btnBox a{
width: 100%;
}
.card {
margin-bottom: 10px;
}

View File

@ -4,12 +4,16 @@ class TgApp {
constructor(containerId, userId) {
this.container = document.getElementById(containerId);
this.userId = userId;
this.btnBox = this.createBox("btnBox");
this.container.appendChild(this.btnBox);
console.log(userId)
}
actionMain(){
console.log("main 123")
this.createCardBox();
// this.createDefaultBox();
this.getScanBtn();
this.getCard();
}
@ -46,11 +50,34 @@ class TgApp {
})
.then((response) => response.json())
.then((data) => {
console.log(data)
this.cardBox.innerHTML = templates.cardBox(data.card_file.file, data.balance)
// {title: "foo", body: "bar", userId: 1, id: 101}
})
}
getScanBtn(){
fetch(config.config.apiUrl + `api/tg-bot/get-scan-btn/${this.userId}`, {
method: 'GET', // Здесь так же могут быть GET, PUT, DELETE
headers: {
// Добавляем необходимые заголовки
'Content-type': 'text/html; charset=UTF-8',
},
})
.then((response) => response.json())
.then((data) => {
this.btnBox.innerHTML = data.html
// {title: "foo", body: "bar", userId: 1, id: 101}
})
}
createBox(id){
let box = document.createElement("div");
box.setAttribute("id", id);
return box;
}
getAction(action){
if (action === "actionMain"){
return this.actionMain;