mirror of
https://github.com/oceanprotocol/commons.git
synced 2023-03-15 18:03:00 +01:00
get faucet network from response
This commit is contained in:
parent
7d911bf763
commit
dd9b1b5122
@ -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'
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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
|
||||
}
|
||||
})
|
||||
|
@ -23,7 +23,7 @@
|
||||
},
|
||||
{
|
||||
"name": "faucet",
|
||||
"version": "~0.2.4"
|
||||
"version": "~0.3.1"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user