From 18267a1a18bc2df543f45d38646eda0db08d805d Mon Sep 17 00:00:00 2001 From: Matthias Kretschmann Date: Mon, 8 Apr 2019 19:46:53 +0200 Subject: [PATCH] simplify consume buttons logic --- client/src/routes/Details/AssetFile.tsx | 47 +++++++++---------------- 1 file changed, 17 insertions(+), 30 deletions(-) diff --git a/client/src/routes/Details/AssetFile.tsx b/client/src/routes/Details/AssetFile.tsx index f6d4c9a..0c0164a 100644 --- a/client/src/routes/Details/AssetFile.tsx +++ b/client/src/routes/Details/AssetFile.tsx @@ -39,7 +39,7 @@ export default class AssetFile extends PureComponent< }) const { ocean } = this.context - + try { const accounts = await ocean.accounts.list() const service = ddo.findServiceByType('Access') @@ -75,6 +75,8 @@ export default class AssetFile extends PureComponent< public render() { const { ddo, file } = this.props + const { isLoading, message, error } = this.state + const { isLogged, startLogin } = this.context return (
@@ -89,39 +91,24 @@ export default class AssetFile extends PureComponent< {/*
  • {file.compression}
  • */} - {this.state.isLoading ? ( - + {isLoading ? ( + ) : ( - - {states => - states.isLogged ? ( - - ) : ( - states.isWeb3 && ( - - ) - ) + )} - {this.state.error !== '' && ( -
    {this.state.error}
    - )} + {error !== '' &&
    {error}
    }
    ) }