Skip to content

Commit

Permalink
fix: item id instead token id
Browse files Browse the repository at this point in the history
  • Loading branch information
meelrossi committed Jun 18, 2024
1 parent 2b9c54a commit 7802925
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,7 @@ import { getOpenRentalId } from '../../modules/rental/utils'
import { FetchOneOptions } from '../../modules/vendor'
import { ContractName } from '../../modules/vendor/decentraland'
import { convertToOutputString } from '../../utils/output'
import {
getItemContractAddressFromUrl,
getItemTokenIdFromUrl,
getNFTContractAddressFromUrl,
getNFTTokenIdFromUrl
} from '../../utils/routing'
import { getItemContractAddressFromUrl, getItemIdFromUrl, getNFTContractAddressFromUrl, getNFTTokenIdFromUrl } from '../../utils/routing'
import AssetProvider from './AssetProvider'
import { MapDispatch, MapDispatchProps, MapStateProps, OwnProps } from './AssetProvider.types'

Expand All @@ -51,7 +46,7 @@ const mapState = (state: RootState, ownProps: OwnProps): MapStateProps => {
case AssetType.ITEM: {
const items = getItems(state)
contractAddress = contractAddress || getItemContractAddressFromUrl()
tokenId = tokenId || getItemTokenIdFromUrl()
tokenId = tokenId || getItemIdFromUrl()
asset = getItem(contractAddress, tokenId, items)
isLoading = isFetchingItem(state, contractAddress!, tokenId!)
error = getItemsError(state)
Expand Down
4 changes: 2 additions & 2 deletions webapp/src/utils/routing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ export const getCollectionDetailUrlParams = () =>
export const getCollectionContractAddressFromUrl = () => getCollectionDetailUrlParams()?.contractAddress.toLowerCase() || null

export const getItemUrlParams = () =>
matchAppRoute<{ contractAddress: string; tokenId: string }>(window.location.pathname, locations.item())?.params
matchAppRoute<{ contractAddress: string; itemId: string }>(window.location.pathname, locations.item())?.params
export const getItemContractAddressFromUrl = () => getItemUrlParams()?.contractAddress.toLowerCase() || null
export const getItemTokenIdFromUrl = () => getItemUrlParams()?.tokenId || null
export const getItemIdFromUrl = () => getItemUrlParams()?.itemId || null

export const getNFTUrlParams = () =>
matchAppRoute<{ contractAddress: string; tokenId: string }>(window.location.pathname, locations.nft())?.params
Expand Down

0 comments on commit 7802925

Please sign in to comment.