mirror of
https://github.com/oceanprotocol/commons.git
synced 2023-03-15 18:03:00 +01:00
lint fixes
This commit is contained in:
parent
bcede18c50
commit
6053fcdf2a
@ -6,6 +6,7 @@ interface ButtonProps {
|
|||||||
primary?: boolean
|
primary?: boolean
|
||||||
link?: boolean
|
link?: boolean
|
||||||
href?: string
|
href?: string
|
||||||
|
onClick?: any
|
||||||
}
|
}
|
||||||
|
|
||||||
export default class Button extends PureComponent<ButtonProps, any> {
|
export default class Button extends PureComponent<ButtonProps, any> {
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
import { Logger } from '@oceanprotocol/squid'
|
import { Logger } from '@oceanprotocol/squid'
|
||||||
import React, { Component } from 'react'
|
import React, { Component } from 'react'
|
||||||
|
import Button from '../components/atoms/Button'
|
||||||
import { User } from '../context/User'
|
import { User } from '../context/User'
|
||||||
|
|
||||||
interface DetailsState {
|
interface DetailsState {
|
||||||
@ -12,7 +13,7 @@ interface DetailsProps {
|
|||||||
match: any
|
match: any
|
||||||
}
|
}
|
||||||
|
|
||||||
class Details extends Component<DetailsProps, DetailsState> {
|
export default class Details extends Component<DetailsProps, DetailsState> {
|
||||||
public state = { ddo: null, metadata: null }
|
public state = { ddo: null, metadata: null }
|
||||||
|
|
||||||
public async componentDidMount() {
|
public async componentDidMount() {
|
||||||
@ -23,18 +24,6 @@ class Details extends Component<DetailsProps, DetailsState> {
|
|||||||
this.setState({ ddo, metadata })
|
this.setState({ ddo, metadata })
|
||||||
}
|
}
|
||||||
|
|
||||||
public render() {
|
|
||||||
return (
|
|
||||||
<>
|
|
||||||
{this.state.metadata ? (
|
|
||||||
this.showDetails(this.state.ddo)
|
|
||||||
) : (
|
|
||||||
<div>Loading</div>
|
|
||||||
)}
|
|
||||||
</>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
private purchaseAsset = async (ddo: any) => {
|
private purchaseAsset = async (ddo: any) => {
|
||||||
const account = await this.context.ocean.getAccounts()
|
const account = await this.context.ocean.getAccounts()
|
||||||
const service = ddo.findServiceByType('Access')
|
const service = ddo.findServiceByType('Access')
|
||||||
@ -65,13 +54,25 @@ class Details extends Component<DetailsProps, DetailsState> {
|
|||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<div>{JSON.stringify(this.state.metadata)}</div>
|
<div>{JSON.stringify(this.state.metadata)}</div>
|
||||||
<button onClick={this.purchaseAsset(ddo)}>
|
|
||||||
|
<Button onClick={this.purchaseAsset(ddo)}>
|
||||||
Purchase asset
|
Purchase asset
|
||||||
</button>
|
</Button>
|
||||||
|
</>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
public render() {
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
{this.state.metadata ? (
|
||||||
|
this.showDetails(this.state.ddo)
|
||||||
|
) : (
|
||||||
|
<div>Loading</div>
|
||||||
|
)}
|
||||||
</>
|
</>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Details.contextType = User
|
Details.contextType = User
|
||||||
export default Details
|
|
||||||
|
Loading…
Reference in New Issue
Block a user