mirror of
https://github.com/lnbits/lnbits.git
synced 2025-09-28 21:02:31 +02:00
get saved data and alert when data changed
This commit is contained in:
@@ -3,7 +3,7 @@
|
|||||||
<div class="row q-col-gutter-md justify-center">
|
<div class="row q-col-gutter-md justify-center">
|
||||||
<div class="col q-gutter-y-md q-my-md">
|
<div class="col q-gutter-y-md q-my-md">
|
||||||
<q-btn label="Save" color="primary" @click="updateSettings">
|
<q-btn label="Save" color="primary" @click="updateSettings">
|
||||||
<q-badge v-if="settingsChanged" color="red" rounded floating style="padding: 6px; border-radius: 6px"/>
|
<q-badge v-if="checkChanges" color="red" rounded floating style="padding: 6px; border-radius: 6px"/>
|
||||||
</q-btn>
|
</q-btn>
|
||||||
<q-btn
|
<q-btn
|
||||||
label="Restart server"
|
label="Restart server"
|
||||||
@@ -114,23 +114,18 @@
|
|||||||
topUpDialog: {
|
topUpDialog: {
|
||||||
show: false
|
show: false
|
||||||
},
|
},
|
||||||
tab: 'funding',
|
tab: 'funding'
|
||||||
settingsChanged: false
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
created: function () {
|
created: function () {
|
||||||
this.settings = JSON.parse('{{ settings|tojson|safe }}') //DB data
|
this.settings = JSON.parse('{{ settings|tojson|safe }}') //DB data
|
||||||
this.balance = +'{{ balance|safe }}'
|
this.balance = +'{{ balance|safe }}'
|
||||||
this.formData = _.clone(this.settings) //model
|
this.formData = _.clone(this.settings) //model
|
||||||
//this.formData.lnbits_ad_space = "hdh"
|
|
||||||
console.log(this.formData)
|
|
||||||
console.log(_.isEqual(this.settings, this.formData))
|
console.log(_.isEqual(this.settings, this.formData))
|
||||||
console.log(this.g.extensions)
|
|
||||||
|
|
||||||
},
|
},
|
||||||
watch: {
|
computed: {
|
||||||
settingsChanged(e){
|
checkChanges(){
|
||||||
return _.isEqual(this.settings, this.formData)
|
return !_.isEqual(this.settings, this.formData)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
@@ -235,7 +230,6 @@
|
|||||||
lnbits_custom_logo: this.formData.lnbits_custom_logo,
|
lnbits_custom_logo: this.formData.lnbits_custom_logo,
|
||||||
lnbits_ad_space: this.formData.lnbits_ad_space.toString()
|
lnbits_ad_space: this.formData.lnbits_ad_space.toString()
|
||||||
}
|
}
|
||||||
console.log(data)
|
|
||||||
LNbits.api
|
LNbits.api
|
||||||
.request(
|
.request(
|
||||||
'PUT',
|
'PUT',
|
||||||
@@ -244,6 +238,8 @@
|
|||||||
data
|
data
|
||||||
)
|
)
|
||||||
.then(response => {
|
.then(response => {
|
||||||
|
this.settings = response.data.settings
|
||||||
|
this.formData = _.clone(this.settings)
|
||||||
this.$q.notify({
|
this.$q.notify({
|
||||||
type: 'positive',
|
type: 'positive',
|
||||||
message: 'Success! Settings changed!',
|
message: 'Success! Settings changed!',
|
||||||
|
@@ -43,8 +43,9 @@ async def api_update_settings(
|
|||||||
user: User = Depends(check_admin),
|
user: User = Depends(check_admin),
|
||||||
data: UpdateSettings = Body(...),
|
data: UpdateSettings = Body(...),
|
||||||
):
|
):
|
||||||
await update_settings(data)
|
settings = await update_settings(data)
|
||||||
return {"status": "Success"}
|
logger.debug(settings)
|
||||||
|
return {"status": "Success", "settings": settings.dict()}
|
||||||
|
|
||||||
|
|
||||||
@admin_ext.delete("/api/v1/settings/", status_code=HTTPStatus.OK)
|
@admin_ext.delete("/api/v1/settings/", status_code=HTTPStatus.OK)
|
||||||
|
Reference in New Issue
Block a user