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:
parent
cf44ab7f51
commit
c89b5995d4
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user