get faucet network from response

This commit is contained in:
Matthias Kretschmann 2019-09-10 16:04:42 +02:00
parent 7d911bf763
commit dd9b1b5122
Signed by: m
GPG Key ID: 606EEEF3C479A91F
3 changed files with 10 additions and 13 deletions

View File

@ -34,7 +34,8 @@ const stateMockIncomplete = {
},
faucet: {
name: 'Faucet',
version: undefined
version: undefined,
network: undefined
},
status: {
ok: false,
@ -46,7 +47,8 @@ const stateMockIncomplete = {
const mockResponse = {
data: {
software: 'Faucet',
version: '6.6.6'
version: '6.6.6',
network: 'Pacific'
}
}

View File

@ -47,14 +47,6 @@ export default class VersionNumbers extends PureComponent<
? 'Spree'
: new URL(nodeUri).hostname.split('.')[0]
public faucetNetwork = faucetUri.includes('dev-ocean')
? new URL(faucetUri).hostname.split('.')[1]
: faucetUri.includes('oceanprotocol.com')
? 'Pacific'
: faucetUri.includes('localhost')
? 'Spree'
: 'Unknown'
// define a minimal default state to fill UI
public state: VersionNumbersState = {
commons: {
@ -77,7 +69,7 @@ export default class VersionNumbers extends PureComponent<
faucet: {
name: 'Faucet',
version: '',
network: this.faucetNetwork,
network: '',
status: OceanPlatformTechStatus.Loading
},
status: {
@ -135,11 +127,14 @@ export default class VersionNumbers extends PureComponent<
// fail silently
if (response.status !== 200) return
const { version, network } = response.data
this.setState({
...this.state,
faucet: {
...this.state.faucet,
version: response.data.version,
version,
network,
status: OceanPlatformTechStatus.Working
}
})

View File

@ -23,7 +23,7 @@
},
{
"name": "faucet",
"version": "~0.2.4"
"version": "~0.3.1"
}
]
}