Revert "Revert "Improve configuration form for readability and UX"" (#11)

Co-authored-by: blackcoffeexbt <87530449+blackcoffeexbt@users.noreply.github.com>
This commit is contained in:
Arc 2026-01-12 11:16:37 +00:00 • committed by GitHub
commit 65da39e0b4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 47 additions and 18 deletions

View file

@ -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',