1
0
mirror of https://github.com/oceanprotocol/commons.git synced 2023-03-15 18:03:00 +01:00

Merge pull request #195 from oceanprotocol/feature/faucet-version

get faucet network from response
This commit is contained in:
Matthias Kretschmann 2019-09-11 10:42:20 +02:00 committed by GitHub
commit 8b155b375f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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"
}
]
}