From 65da39e0b46a79a752648472b229a9a2a1de211f Mon Sep 17 00:00:00 2001 From: Arc <33088785+arcbtc@users.noreply.github.com> Date: Mon, 12 Jan 2026 11:16:37 +0000 Subject: [PATCH] Revert "Revert "Improve configuration form for readability and UX"" (#11) Co-authored-by: blackcoffeexbt <87530449+blackcoffeexbt@users.noreply.github.com> --- static/js/admin.js | 18 ++++-------- templates/nwcprovider/admin.html | 47 ++++++++++++++++++++++++++++---- 2 files changed, 47 insertions(+), 18 deletions(-) diff --git a/static/js/admin.js b/static/js/admin.js index 2e18b9b..38acf69 100644 --- a/static/js/admin.js +++ b/static/js/admin.js @@ -4,7 +4,7 @@ window.app = Vue.createApp({ delimiters: ['${', '}'], data: function () { return { - entries: [], + config: {}, columns: [ { name: 'key', @@ -36,15 +36,8 @@ window.app = Vue.createApp({ this.g.user.wallets[0].adminkey ) .then(response => { - const newEntries = [] - for (const [key, value] of Object.entries(response.data)) { - newEntries.push({ - key: key, - value: value - }) - } - this.entries.length = 0 - this.entries.push(...newEntries) + this.config = response.data + console.log('Config fetched:', this.config) }) .catch(function (error) { console.error('Error fetching config:', error) @@ -52,9 +45,10 @@ window.app = Vue.createApp({ }, async saveConfig() { const data = {} - for (const entry of this.entries) { - data[entry.key] = entry.value + for (const [key, value] of Object.entries(this.config)) { + data[key] = value } + console.log('Saving config:', data) try { const response = await LNbits.api.request( 'POST', diff --git a/templates/nwcprovider/admin.html b/templates/nwcprovider/admin.html index 171a6d0..81576b4 100644 --- a/templates/nwcprovider/admin.html +++ b/templates/nwcprovider/admin.html @@ -6,21 +6,56 @@