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

lint fixes

This commit is contained in:
Matthias Kretschmann 2019-02-05 17:29:01 +01:00
parent bcede18c50
commit 6053fcdf2a
Signed by: m
GPG Key ID: 606EEEF3C479A91F
2 changed files with 18 additions and 16 deletions

View File

@ -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> {

View File

@ -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