Merge pull request #14 from Permissionless-Software-Foundation/dh-server-refresh

fix(server): Fixed Refreshing forgets new server
This commit is contained in:
Chris Troutner
2022-02-26 05:10:14 -08:00
committed by GitHub
5 changed files with 15 additions and 9 deletions
@@ -21,7 +21,8 @@ class Servers extends React.Component {
selectedServer: '',
showAddField: false,
newServer: '',
inFetch: false
inFetch: false,
currentServer: ''
}
_this.BchWallet = BchWallet
}
@@ -90,6 +91,7 @@ class Servers extends React.Component {
text='Update'
type='primary'
className='btn-lg'
disabled={_this.state.selectedServer === _this.state.currentServer}
onClick={_this.handleUpdateServer}
/>
</Box>
@@ -178,6 +180,7 @@ class Servers extends React.Component {
}
_this.setState({
selectOptions,
currentServer: walletInfo.selectedServer,
selectedServer: walletInfo.selectedServer
})
} catch (error) {
@@ -207,6 +210,9 @@ class Servers extends React.Component {
setTimeout(() => {
_this.updateWalletInstance()
}, 500)
_this.setState({
currentServer: _this.state.selectedServer
})
}
// Update the wallet instance state
+5 -5
View File
@@ -405,15 +405,15 @@ class AdminLTEPage extends React.Component {
// return if servers configurations exist
if (walletInfo.selectedServer) return null
const server1 = 'https://bchn.fullstack.cash/v5/'
const server2 = 'https://abc.fullstack.cash/v5/'
const server1 = 'https://free-bch.fullstack.cash/'
const server2 = 'http://localhost:5005/'
const servers = [server1, server2]
// Default server is BCHN.
let selectedServer = server1
const selectedServer = server1
if (accessLocation === 'wallet.fullstack.cash') {
/* if (accessLocation === 'wallet.fullstack.cash') {
selectedServer = server1
}
@@ -429,7 +429,7 @@ class AdminLTEPage extends React.Component {
// Split uses BCHN by default
if (accessLocation === 'splitbch.com') {
selectedServer = server1
}
} */
walletInfo.selectedServer = selectedServer
walletInfo.servers = servers
+1 -1
View File
@@ -139,7 +139,7 @@ class NewWallet extends React.Component {
if (_interface === 'consumer-api') {
bchjsOptions.interface = _interface
bchjsOptions.restURL = siteConfig.restURL
bchjsOptions.restURL = restURL
return bchjsOptions
}
+1 -1
View File
@@ -180,7 +180,7 @@ class ImportWallet extends React.Component {
if (_interface === 'consumer-api') {
bchjsOptions.interface = _interface
bchjsOptions.restURL = siteConfig.restURL
bchjsOptions.restURL = restURL
return bchjsOptions
}
+1 -1
View File
@@ -102,7 +102,7 @@ const getBchjsOptions = () => {
if (_interface === 'consumer-api') {
bchjsOptions.interface = _interface
bchjsOptions.restURL = siteConfig.restURL
bchjsOptions.restURL = restURL
return bchjsOptions
}