1
0
mirror of https://github.com/oceanprotocol/market.git synced 2024-11-15 01:34:57 +01:00

more reliable isOwner check (#547)

This commit is contained in:
Matthias Kretschmann 2021-04-22 16:29:40 +02:00 committed by GitHub
parent cf44ab7f51
commit c89b5995d4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -46,13 +46,16 @@ export default function AssetContent(props: AssetContentProps): ReactElement {
const { owner, isInPurgatory, purgatoryData } = useAsset()
const [showPricing, setShowPricing] = useState(false)
const [showEdit, setShowEdit] = useState<boolean>()
const [isOwner, setIsOwner] = useState(false)
const { ddo, price, metadata } = useAsset()
const isOwner = accountId === owner
useEffect(() => {
if (!price) return
if (!accountId || !owner) return
const isOwner = accountId.toLowerCase() === owner.toLowerCase()
setIsOwner(isOwner)
setShowPricing(isOwner && price.type === '')
}, [isOwner, price])
}, [accountId, price, owner])
function handleEditButton() {
// move user's focus to top of screen