feat: adds an upload for assets on backgroundImage in account and site customisation (#3929)

Co-authored-by: dni  <office@dnilabs.com>
Co-authored-by: alan <alan@lnbits.com>
This commit is contained in:
Arc
2026-04-16 14:05:24 +02:00
committed by GitHub
co-authored by dni ⚡ alan
parent 07b1521dad
commit 4b4b6d0bcd
5 changed files with 103 additions and 11 deletions
@@ -41,5 +41,37 @@ window.app.component('lnbits-admin-site-customisation', {
]
}
},
methods: {}
methods: {
onBackgroundImageInput(e) {
const file = e.target.files[0]
if (file) {
this.uploadBackgroundImage(file)
}
e.target.value = null
},
async uploadBackgroundImage(file) {
const formData = new FormData()
formData.append('file', file)
try {
const {data} = await LNbits.api.request(
'POST',
'/api/v1/assets?public_asset=true',
null,
formData,
{
headers: {'Content-Type': 'multipart/form-data'}
}
)
const assetUrl = `${window.location.origin}/api/v1/assets/${data.id}/thumbnail`
this.formData.lnbits_default_bgimage = assetUrl
Quasar.Notify.create({
type: 'positive',
message: 'Background image uploaded.',
icon: null
})
} catch (e) {
LNbits.utils.notifyApiError(e)
}
}
}
})