mirror of
https://github.com/oceanprotocol/commons.git
synced 2023-03-15 18:03:00 +01:00
prepare outputting more status messages from network
This commit is contained in:
parent
de91b301f0
commit
3fb426413d
@ -40,6 +40,7 @@ interface AppState {
|
|||||||
web3: Web3
|
web3: Web3
|
||||||
ocean: {}
|
ocean: {}
|
||||||
startLogin: () => void
|
startLogin: () => void
|
||||||
|
message: string
|
||||||
}
|
}
|
||||||
|
|
||||||
class App extends Component<{}, AppState> {
|
class App extends Component<{}, AppState> {
|
||||||
@ -94,7 +95,8 @@ class App extends Component<{}, AppState> {
|
|||||||
account: '',
|
account: '',
|
||||||
ocean: {},
|
ocean: {},
|
||||||
startLogin: this.startLogin,
|
startLogin: this.startLogin,
|
||||||
requestFromFaucet: this.requestFromFaucet
|
requestFromFaucet: this.requestFromFaucet,
|
||||||
|
message: 'Connecting to Ocean...'
|
||||||
}
|
}
|
||||||
|
|
||||||
public async componentDidMount() {
|
public async componentDidMount() {
|
||||||
@ -185,7 +187,7 @@ class App extends Component<{}, AppState> {
|
|||||||
<main className={styles.main}>
|
<main className={styles.main}>
|
||||||
{this.state.isLoading ? (
|
{this.state.isLoading ? (
|
||||||
<div className={styles.loader}>
|
<div className={styles.loader}>
|
||||||
<Spinner message="Connecting to Ocean..." />
|
<Spinner message={this.state.message} />
|
||||||
</div>
|
</div>
|
||||||
) : (
|
) : (
|
||||||
<Routes />
|
<Routes />
|
||||||
|
@ -11,13 +11,26 @@ interface AssetFilesDetailsProps {
|
|||||||
ddo: any
|
ddo: any
|
||||||
}
|
}
|
||||||
|
|
||||||
|
interface AssetFilesDetailsState {
|
||||||
|
isLoading: boolean
|
||||||
|
error: string
|
||||||
|
message: string
|
||||||
|
}
|
||||||
|
|
||||||
export default class AssetFilesDetails extends PureComponent<
|
export default class AssetFilesDetails extends PureComponent<
|
||||||
AssetFilesDetailsProps
|
AssetFilesDetailsProps,
|
||||||
|
AssetFilesDetailsState
|
||||||
> {
|
> {
|
||||||
public state = { isLoading: false, error: null }
|
public state = {
|
||||||
|
isLoading: false,
|
||||||
|
error: '',
|
||||||
|
message: 'Decrypting files, please sign with your wallet...'
|
||||||
|
}
|
||||||
|
|
||||||
|
private resetState = () => this.setState({ isLoading: true, error: '' })
|
||||||
|
|
||||||
private purchaseAsset = async (ddo: any) => {
|
private purchaseAsset = async (ddo: any) => {
|
||||||
this.setState({ isLoading: true, error: null })
|
this.resetState()
|
||||||
|
|
||||||
const { ocean } = this.context
|
const { ocean } = this.context
|
||||||
const accounts = await ocean.accounts.list()
|
const accounts = await ocean.accounts.list()
|
||||||
@ -69,7 +82,7 @@ export default class AssetFilesDetails extends PureComponent<
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
{this.state.isLoading ? (
|
{this.state.isLoading ? (
|
||||||
<Spinner message="Decrypting files, please sign with your wallet..." />
|
<Spinner message={this.state.message} />
|
||||||
) : (
|
) : (
|
||||||
<Button
|
<Button
|
||||||
primary
|
primary
|
||||||
@ -80,7 +93,7 @@ export default class AssetFilesDetails extends PureComponent<
|
|||||||
</Button>
|
</Button>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{this.state.error && (
|
{this.state.error !== '' && (
|
||||||
<div className={styles.error}>{this.state.error}</div>
|
<div className={styles.error}>{this.state.error}</div>
|
||||||
)}
|
)}
|
||||||
</>
|
</>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user