fix: regression in node.js (#3521)

This commit is contained in:
dni ⚡ 2025-11-13 16:07:09 +01:00 committed by GitHub
parent ff7f5c1ca5
commit ee57ba4c1a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 14 additions and 14 deletions

File diff suppressed because one or more lines are too long

View file

@ -206,7 +206,7 @@ window.PageNode = {
formatMsat(msat) { formatMsat(msat) {
return LNbits.utils.formatMsat(msat) return LNbits.utils.formatMsat(msat)
}, },
api(method, url, options) { nodeApi(method, url, options) {
const params = new URLSearchParams(options?.query) const params = new URLSearchParams(options?.query)
return LNbits.api return LNbits.api
.request(method, `/node/api/v1${url}?${params}`, {}, options?.data) .request(method, `/node/api/v1${url}?${params}`, {}, options?.data)
@ -215,18 +215,18 @@ window.PageNode = {
}) })
}, },
getChannel(channel_id) { getChannel(channel_id) {
return this.api('GET', `/channels/${channel_id}`).then(response => { return this.nodeApi('GET', `/channels/${channel_id}`).then(response => {
this.setFeeDialog.data.fee_ppm = response.data.fee_ppm this.setFeeDialog.data.fee_ppm = response.data.fee_ppm
this.setFeeDialog.data.fee_base_msat = response.data.fee_base_msat this.setFeeDialog.data.fee_base_msat = response.data.fee_base_msat
}) })
}, },
getChannels() { getChannels() {
return this.api('GET', '/channels').then(response => { return this.nodeApi('GET', '/channels').then(response => {
this.channels.data = response.data this.channels.data = response.data
}) })
}, },
getInfo() { getInfo() {
return this.api('GET', '/info') return this.nodeApi('GET', '/info')
.then(response => { .then(response => {
this.info = response.data this.info = response.data
this.channel_stats = response.data.channel_stats this.channel_stats = response.data.channel_stats
@ -237,7 +237,7 @@ window.PageNode = {
}) })
}, },
get1MLStats() { get1MLStats() {
return this.api('GET', '/rank') return this.nodeApi('GET', '/rank')
.then(response => { .then(response => {
this.ranks = response.data this.ranks = response.data
}) })
@ -254,7 +254,7 @@ window.PageNode = {
limit: pagination.rowsPerPage, limit: pagination.rowsPerPage,
offset: (pagination.page - 1) * pagination.rowsPerPage ?? 0 offset: (pagination.page - 1) * pagination.rowsPerPage ?? 0
} }
return this.api('GET', '/payments', {query}).then(response => { return this.nodeApi('GET', '/payments', {query}).then(response => {
this.paymentsTable.data = response.data.data this.paymentsTable.data = response.data.data
this.paymentsTable.pagination.rowsNumber = response.data.total this.paymentsTable.pagination.rowsNumber = response.data.total
}) })
@ -268,18 +268,18 @@ window.PageNode = {
limit: pagination.rowsPerPage, limit: pagination.rowsPerPage,
offset: (pagination.page - 1) * pagination.rowsPerPage ?? 0 offset: (pagination.page - 1) * pagination.rowsPerPage ?? 0
} }
return this.api('GET', '/invoices', {query}).then(response => { return this.nodeApi('GET', '/invoices', {query}).then(response => {
this.invoiceTable.data = response.data.data this.invoiceTable.data = response.data.data
this.invoiceTable.pagination.rowsNumber = response.data.total this.invoiceTable.pagination.rowsNumber = response.data.total
}) })
}, },
getPeers() { getPeers() {
return this.api('GET', '/peers').then(response => { return this.nodeApi('GET', '/peers').then(response => {
this.peers.data = response.data this.peers.data = response.data
}) })
}, },
connectPeer() { connectPeer() {
this.api('POST', '/peers', {data: this.connectPeerDialog.data}).then( this.nodeApi('POST', '/peers', {data: this.connectPeerDialog.data}).then(
() => { () => {
this.connectPeerDialog.show = false this.connectPeerDialog.show = false
this.getPeers() this.getPeers()
@ -290,7 +290,7 @@ window.PageNode = {
LNbits.utils LNbits.utils
.confirmDialog('Do you really wanna disconnect this peer?') .confirmDialog('Do you really wanna disconnect this peer?')
.onOk(() => { .onOk(() => {
this.api('DELETE', `/peers/${id}`).then(response => { this.nodeApi('DELETE', `/peers/${id}`).then(response => {
Quasar.Notify.create({ Quasar.Notify.create({
message: 'Disconnected', message: 'Disconnected',
icon: null icon: null
@ -301,7 +301,7 @@ window.PageNode = {
}) })
}, },
setChannelFee(channel_id) { setChannelFee(channel_id) {
this.api('PUT', `/channels/${channel_id}`, { this.nodeApi('PUT', `/channels/${channel_id}`, {
data: this.setFeeDialog.data data: this.setFeeDialog.data
}) })
.then(response => { .then(response => {
@ -311,7 +311,7 @@ window.PageNode = {
.catch(LNbits.utils.notifyApiError) .catch(LNbits.utils.notifyApiError)
}, },
openChannel() { openChannel() {
this.api('POST', '/channels', {data: this.openChannelDialog.data}) this.nodeApi('POST', '/channels', {data: this.openChannelDialog.data})
.then(response => { .then(response => {
this.openChannelDialog.show = false this.openChannelDialog.show = false
this.getChannels() this.getChannels()
@ -329,7 +329,7 @@ window.PageNode = {
} }
}, },
closeChannel() { closeChannel() {
this.api('DELETE', '/channels', { this.nodeApi('DELETE', '/channels', {
query: this.closeChannelDialog.data query: this.closeChannelDialog.data
}).then(response => { }).then(response => {
this.closeChannelDialog.show = false this.closeChannelDialog.show = false