diff --git a/src/App.js b/src/App.js index ea66391..53d545d 100644 --- a/src/App.js +++ b/src/App.js @@ -16,16 +16,6 @@ import Footer from './components/footer' import NavMenu from './components/nav-menu' import AppBody from './components/app-body' -// Default alternative servers. -const defaultServerOptions = [ - { value: 'https://free-bch.fullstack.cash', label: 'https://free-bch.fullstack.cash' }, - { value: 'https://bc01-ca-bch-consumer.fullstackcash.nl', label: 'https://bc01-ca-bch-consumer.fullstackcash.nl' }, - { value: 'https://pdx01-usa-bch-consumer.fullstackcash.nl', label: 'https://pdx01-usa-bch-consumer.fullstackcash.nl' }, - { value: 'https://wa-usa-bch-consumer.fullstackcash.nl', label: 'https://wa-usa-bch-consumer.fullstackcash.nl' } -] - -// let _this - function App (props) { // BEGIN STATE @@ -38,7 +28,7 @@ function App (props) { const [menuState, setMenuState] = useState(0) const [wallet, setWallet] = useState(false) - const [servers, setServers] = useState(defaultServerOptions) + const [servers, setServers] = useState([]) // Startup state // When the page is loaded, it goes through a series of async network calls @@ -52,7 +42,7 @@ function App (props) { const [showStartModal, setShowStartModal] = useState(true) const [modalBody, setModalBody] = useState([]) const [hideSpinner, setHideSpinner] = useState(false) - const [denyClose, setDenyClose] = useState(false) + const [denyClose, setDenyClose] = useState(false) // Deny modal to be closed // Load all the app state into a single object that can be passed to child // components. diff --git a/src/services/async-load.js b/src/services/async-load.js index dc0f6c0..8d15de3 100644 --- a/src/services/async-load.js +++ b/src/services/async-load.js @@ -92,22 +92,15 @@ class AsyncLoad { const gistLib = new GistServers() const gistServers = await gistLib.getServerList() - const serversAry = [] - - for (let i = 0; i < gistServers.length; i++) { - serversAry.push({ value: gistServers[i].url, label: gistServers[i].url }) - } - - return serversAry + return gistServers } catch (err) { console.error('Error trying to retrieve list of servers from GitHub: ', err) console.log('Returning hard-coded list of servers.') const defaultOptions = [ { value: 'https://free-bch.fullstack.cash', label: 'https://free-bch.fullstack.cash' }, - { value: 'https://bc01-ca-bch-consumer.fullstackcash.nl', label: 'https://bc01-ca-bch-consumer.fullstackcash.nl' }, - { value: 'https://pdx01-usa-bch-consumer.fullstackcash.nl', label: 'https://pdx01-usa-bch-consumer.fullstackcash.nl' }, - { value: 'https://wa-usa-bch-consumer.fullstackcash.nl', label: 'https://wa-usa-bch-consumer.fullstackcash.nl' } + { value: 'https://dev-consumer.psfoundation.info', label: 'https://dev-consumer.psfoundation.info' } + ] return defaultOptions diff --git a/src/services/gist-servers.js b/src/services/gist-servers.js index f4e72f0..39e9e33 100644 --- a/src/services/gist-servers.js +++ b/src/services/gist-servers.js @@ -13,22 +13,19 @@ class GistServers { async getServerList () { try { // https://gist.github.com/christroutner/e818ecdaed6c35075bfc0751bf222258 - const gistUrl = - 'https://api.github.com/gists/63c5513782181f8b8ea3eb89f7cadeb6' + // 'https://api.github.com/gists/63c5513782181f8b8ea3eb89f7cadeb6' + + const gistUrl = 'https://consumers.psfoundation.info/consumers.json' // Retrieve the gist from github.com. const result = await this.axios.get(gistUrl) - // console.log('result.data: ', result.data) + console.log('result.data: ', result.data) // Get the current content of the gist. - const content = result.data.files['psf-consumer-apis.json'].content + const content = result.data.servers // console.log('content: ', content) - // Parse the JSON string into an Object. - const object = JSON.parse(content) - // console.log('object: ', object) - - return object.consumerApis + return content } catch (err) { console.error('Error in getCRList()') throw err