mirror of
https://github.com/oceanprotocol/market.git
synced 2024-12-02 05:57:29 +01:00
move isOwner check to single effect
This commit is contained in:
parent
8656a6c51b
commit
2b025ea38c
@ -86,7 +86,6 @@ function AssetProvider({
|
||||
}))
|
||||
setTitle(asset.metadata?.name)
|
||||
setOwner(asset.nft?.owner)
|
||||
setIsOwner(accountId?.toLowerCase() === asset?.nft?.owner.toLowerCase())
|
||||
setIsInPurgatory(asset.purgatory?.state)
|
||||
setPurgatoryData(asset.purgatory)
|
||||
LoggerInstance.log('[asset] Got asset', asset)
|
||||
@ -130,7 +129,6 @@ function AssetProvider({
|
||||
useEffect(() => {
|
||||
if (!isMounted) return
|
||||
|
||||
setIsOwner(accountId?.toLowerCase() === asset?.nft?.owner.toLowerCase())
|
||||
fetchAccessDetails()
|
||||
}, [accountId, fetchAccessDetails, isMounted])
|
||||
|
||||
@ -144,6 +142,16 @@ function AssetProvider({
|
||||
setIsAssetNetwork(isAssetNetwork)
|
||||
}, [chainId, asset?.chainId])
|
||||
|
||||
// -----------------------------------
|
||||
// Asset owner check against wallet user
|
||||
// -----------------------------------
|
||||
useEffect(() => {
|
||||
if (!accountId || !owner) return
|
||||
|
||||
const isOwner = accountId?.toLowerCase() === owner.toLowerCase()
|
||||
setIsOwner(isOwner)
|
||||
}, [accountId, owner])
|
||||
|
||||
// -----------------------------------
|
||||
// Load ocean config based on asset network
|
||||
// -----------------------------------
|
||||
|
Loading…
Reference in New Issue
Block a user