Qortal UI - Main Code Repository A User Interface for the Qortal Blockchain Project. Truly decentralized web hosting, application hosting, communications, data storage, and full infrastructure for the future global decentralized digital world.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

31 lines
630 B

import { waitForConfig, watchConfig } from '../config'
let config = {}
watchConfig((c) => {
config = c
})
export async function request(url, options) {
options = options || {}
const body = options.body
const method = options.method || 'GET'
const headers = options.headers || {}
await waitForConfig()
const n = config.nodeConfig.knownNodes[config.nodeConfig.node]
const node = n.protocol + '://' + n.domain + ':' + n.port
return fetch(node + url, {
method,
headers,
body,
}).then(async (response) => {
try {
return await response.clone().json()
} catch (e) {
return await response.text()
}
})
}