diff --git a/index.html b/index.html index 1e16765..3ce6327 100644 --- a/index.html +++ b/index.html @@ -633,39 +633,46 @@ SELECT * FROM users LIMIT 10;"> } // CRUD Operations - showAddRecordModal() { + async showAddRecordModal() { this.editingRecord = null; document.getElementById('recordModalTitle').textContent = 'Добавить запись'; - this.generateRecordForm(); + + await this.generateRecordForm(); + document.getElementById('recordModal').classList.remove('hidden'); } - editRecord(idx) { + async editRecord(idx) { this.editingRecord = idx; document.getElementById('recordModalTitle').textContent = 'Редактировать запись'; - this.generateRecordForm(); + + await this.generateRecordForm(); + document.getElementById('recordModal').classList.remove('hidden'); } - generateRecordForm() { - // Get columns based on current table structure - const columns = this.getTableStructure(this.currentTable); + async generateRecordForm() { + if (response.status === 401) { + this.logout(); + return []; + } + const columns = await this.getTableStructure(this.currentTable); const container = document.getElementById('recordForm'); - + container.innerHTML = columns.map(col => ` -
- - -

${col.type}

-
- `).join(''); - } +
+ + +

${col.type}

+
+ `).join(''); +} async getTableStructure(tableName) { try {