mirror of
https://github.com/Qortal/qortal-ui.git
synced 2025-02-11 17:55:51 +00:00
Merge pull request #261 from kennycud/master
Adding crosschain server info support for Q-apps
This commit is contained in:
commit
d84ab71d32
@ -25,6 +25,9 @@ export const GET_USER_WALLET = 'GET_USER_WALLET';
|
||||
// GET_USER_WALLET_INFO action
|
||||
export const GET_USER_WALLET_INFO = 'GET_USER_WALLET_INFO';
|
||||
|
||||
// GET_CROSSCHAIN_SERVER_INFO action
|
||||
export const GET_CROSSCHAIN_SERVER_INFO = 'GET_CROSSCHAIN_SERVER_INFO';
|
||||
|
||||
// GET_WALLET_BALANCE action
|
||||
export const GET_WALLET_BALANCE = 'GET_WALLET_BALANCE';
|
||||
|
||||
|
@ -2611,6 +2611,50 @@ class WebBrowser extends LitElement {
|
||||
break
|
||||
}
|
||||
|
||||
case actions.GET_CROSSCHAIN_SERVER_INFO: {
|
||||
const requiredFields = ['coin']
|
||||
const missingFields = []
|
||||
|
||||
requiredFields.forEach((field) => {
|
||||
if (!data[field]) {
|
||||
missingFields.push(field)
|
||||
}
|
||||
})
|
||||
|
||||
if (missingFields.length > 0) {
|
||||
const missingFieldsString = missingFields.join(', ')
|
||||
const errorMsg = `Missing fields: ${missingFieldsString}`
|
||||
let data = {}
|
||||
data['error'] = errorMsg
|
||||
response = JSON.stringify(data)
|
||||
break
|
||||
}
|
||||
|
||||
let _url = `/crosschain/` + data.coin.toLowerCase() + `/serverinfos`
|
||||
try {
|
||||
this.loader.show()
|
||||
const res = await parentEpml.request('apiCall', {
|
||||
url: _url,
|
||||
method: 'GET',
|
||||
headers: {
|
||||
'Accept': '*/*'
|
||||
}
|
||||
})
|
||||
response = JSON.stringify(res.servers);
|
||||
} catch (error) {
|
||||
console.error(error)
|
||||
const data = {}
|
||||
const errorMsg = error.message || 'Error in retrieving server info'
|
||||
data['error'] = errorMsg
|
||||
response = JSON.stringify(data)
|
||||
return
|
||||
} finally {
|
||||
this.loader.hide()
|
||||
}
|
||||
|
||||
break
|
||||
}
|
||||
|
||||
case actions.GET_DAY_SUMMARY: {
|
||||
try {
|
||||
const summary = await parentEpml.request('apiCall', {
|
||||
|
Loading…
x
Reference in New Issue
Block a user