mirror of
https://github.com/lnbits/lnbits.git
synced 2025-10-10 12:32:34 +02:00
update settings and topup logic
This commit is contained in:
@@ -30,7 +30,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<q-form @submit="">
|
<q-form @submit="UpdateLNbits">
|
||||||
<q-tab-panels v-model="tab" animated>
|
<q-tab-panels v-model="tab" animated>
|
||||||
<q-tab-panel name="funding">
|
<q-tab-panel name="funding">
|
||||||
<q-card-section class="q-pa-none">
|
<q-card-section class="q-pa-none">
|
||||||
@@ -61,7 +61,7 @@
|
|||||||
<br />
|
<br />
|
||||||
</div>
|
</div>
|
||||||
<div class="col-12 col-md-6">
|
<div class="col-12 col-md-6">
|
||||||
<q-form @submit="topupWallet">
|
<!-- <q-form @submit="topupWallet"> -->
|
||||||
<p>TopUp a wallet</p>
|
<p>TopUp a wallet</p>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-12">
|
<div class="col-12">
|
||||||
@@ -87,13 +87,13 @@
|
|||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<q-btn
|
<q-btn
|
||||||
class="q-mt-md"
|
class="q-mt-md float-right"
|
||||||
label="Topup"
|
label="Topup"
|
||||||
type="submit"
|
|
||||||
color="primary"
|
color="primary"
|
||||||
|
@click="topupWallet"
|
||||||
></q-btn>
|
></q-btn>
|
||||||
</div>
|
</div>
|
||||||
</q-form>
|
<!-- </q-form> -->
|
||||||
<br />
|
<br />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -577,7 +577,6 @@
|
|||||||
<div>
|
<div>
|
||||||
<p>Site Description</p>
|
<p>Site Description</p>
|
||||||
<q-input
|
<q-input
|
||||||
v-model="text"
|
|
||||||
v-model="data.admin.site_description"
|
v-model="data.admin.site_description"
|
||||||
filled
|
filled
|
||||||
type="textarea"
|
type="textarea"
|
||||||
@@ -1147,7 +1146,8 @@
|
|||||||
let settings = JSON.parse('{{ settings | tojson|safe }}')
|
let settings = JSON.parse('{{ settings | tojson|safe }}')
|
||||||
settings.balance = '{{ balance }}'
|
settings.balance = '{{ balance }}'
|
||||||
this.data.admin = {...this.data.admin, ...settings}
|
this.data.admin = {...this.data.admin, ...settings}
|
||||||
console.log(this.g.user)
|
console.log(this.data.admin)
|
||||||
|
console.log(settings)
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
addAdminUser(){
|
addAdminUser(){
|
||||||
@@ -1189,27 +1189,27 @@
|
|||||||
let spaces = this.data.admin.ad_space
|
let spaces = this.data.admin.ad_space
|
||||||
this.data.admin.ad_space = spaces.filter(s => s !== ad)
|
this.data.admin.ad_space = spaces.filter(s => s !== ad)
|
||||||
},
|
},
|
||||||
topupWallet: function () {
|
topupWallet() {
|
||||||
var self = this
|
|
||||||
LNbits.api
|
LNbits.api
|
||||||
.request(
|
.request(
|
||||||
'GET',
|
'GET',
|
||||||
'/admin/api/v1/admin/' +
|
'/admin/api/v1/admin/' +
|
||||||
self.wallet.id +
|
this.wallet.data.id +
|
||||||
'/' +
|
'/' +
|
||||||
self.wallet.data.amount,
|
this.wallet.data.amount,
|
||||||
self.g.user.wallets[0].adminkey
|
this.g.user.wallets[0].adminkey
|
||||||
)
|
)
|
||||||
.then(function (response) {
|
.then((response) => {
|
||||||
self.$q.notify({
|
this.$q.notify({
|
||||||
type: 'positive',
|
type: 'positive',
|
||||||
message:
|
message:
|
||||||
'Success! Added ' +
|
'Success! Added ' +
|
||||||
self.wallet.amount +
|
this.wallet.data.amount +
|
||||||
' to ' +
|
' to ' +
|
||||||
self.wallet.id,
|
this.wallet.data.id,
|
||||||
icon: null
|
icon: null
|
||||||
})
|
})
|
||||||
|
this.wallet.data = {}
|
||||||
})
|
})
|
||||||
.catch(function (error) {
|
.catch(function (error) {
|
||||||
LNbits.utils.notifyApiError(error)
|
LNbits.utils.notifyApiError(error)
|
||||||
@@ -1224,36 +1224,59 @@
|
|||||||
self.data.admin.edited.push(source)
|
self.data.admin.edited.push(source)
|
||||||
console.log(self.data.admin.edited)
|
console.log(self.data.admin.edited)
|
||||||
},
|
},
|
||||||
UpdateLNbits: function () {
|
UpdateLNbits() {
|
||||||
var self = this
|
let {
|
||||||
let {site_title, admin_users, default_wallet_name, data_folder, disabled_ext, service_fee, funding_source_primary} = this.data.admin
|
admin_users,
|
||||||
let data = {
|
allowed_users,
|
||||||
site_title,
|
admin_ext,
|
||||||
site_tagline: this.data.admin.tagline,
|
disabled_ext,
|
||||||
site_description: this.data.admin.description,
|
funding_source,
|
||||||
admin_users: admin_users.toString(),
|
force_https,
|
||||||
default_wallet_name,
|
|
||||||
data_folder,
|
|
||||||
disabled_ext: disabled_ext.toString(),
|
|
||||||
service_fee,
|
service_fee,
|
||||||
funding_source: funding_source_primary}
|
hide_api,
|
||||||
|
site_title,
|
||||||
|
site_tagline,
|
||||||
|
site_description,
|
||||||
|
default_wallet_name,
|
||||||
|
denomination,
|
||||||
|
theme,
|
||||||
|
ad_space
|
||||||
|
} = this.data.admin
|
||||||
|
//console.log("this", this.data.admin)
|
||||||
|
let data = {
|
||||||
|
admin_users: admin_users.toString(),
|
||||||
|
allowed_users: allowed_users.toString(),
|
||||||
|
admin_ext: admin_ext.toString(),
|
||||||
|
disabled_ext: disabled_ext.toString(),
|
||||||
|
funding_source,
|
||||||
|
force_https,
|
||||||
|
service_fee,
|
||||||
|
hide_api,
|
||||||
|
site_title,
|
||||||
|
site_tagline,
|
||||||
|
site_description,
|
||||||
|
default_wallet_name,
|
||||||
|
denomination,
|
||||||
|
theme: theme.toString(),
|
||||||
|
ad_space: ad_space.toString()
|
||||||
|
}
|
||||||
console.log(data)
|
console.log(data)
|
||||||
LNbits.api
|
LNbits.api
|
||||||
.request(
|
.request(
|
||||||
'POST',
|
'POST',
|
||||||
'/admin/api/v1/admin/',
|
'/admin/api/v1/admin/',
|
||||||
self.g.user.wallets[0].adminkey,
|
this.g.user.wallets[0].adminkey,
|
||||||
data
|
data
|
||||||
)
|
)
|
||||||
.then(function (response) {
|
.then(response => {
|
||||||
console.log(response.data)
|
console.log(response.data)
|
||||||
self.$q.notify({
|
this.$q.notify({
|
||||||
type: 'positive',
|
type: 'positive',
|
||||||
message:
|
message:
|
||||||
'Success! Added ' +
|
'Success! Added ' +
|
||||||
self.wallet.amount +
|
this.wallet.amount +
|
||||||
' to ' +
|
' to ' +
|
||||||
self.wallet.id,
|
this.wallet.id,
|
||||||
icon: null
|
icon: null
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
Reference in New Issue
Block a user