Skip to content

Commit

Permalink
fix: Don't open authorization modal when buying nfts with card (decen…
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinszuchet authored Feb 13, 2023
1 parent 22025e4 commit 1292347
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
7 changes: 6 additions & 1 deletion webapp/src/components/BuyPage/BuyNFTModal/BuyNFTModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,10 @@ const BuyNFTModal = (props: Props) => {
}, [getContract, nft.network, nft.chainId, wallet.address, order])

const handleSubmit = useCallback(() => {
if (authorization && hasAuthorization(authorizations, authorization)) {
if (
(authorization && hasAuthorization(authorizations, authorization)) ||
(isBuyNftsWithFiatEnabled && isBuyWithCardPage)
) {
handleExecuteOrder()
} else {
setShowAuthorizationModal(true)
Expand All @@ -107,6 +110,8 @@ const BuyNFTModal = (props: Props) => {
authorizations,
authorization,
handleExecuteOrder,
isBuyNftsWithFiatEnabled,
isBuyWithCardPage,
setShowAuthorizationModal
])

Expand Down
13 changes: 11 additions & 2 deletions webapp/src/components/BuyPage/MintItemModal/MintItemModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -97,12 +97,21 @@ const MintItemModal = (props: Props) => {
}, [getContract, item.network, item.chainId, wallet.address])

const handleSubmit = useCallback(() => {
if (authorization && hasAuthorization(authorizations, authorization)) {
if (
(authorization && hasAuthorization(authorizations, authorization)) ||
(isBuyNftsWithFiatEnabled && isBuyWithCardPage)
) {
handleExecuteOrder()
} else {
setShowAuthorizationModal(true)
}
}, [authorization, authorizations, handleExecuteOrder])
}, [
authorization,
authorizations,
handleExecuteOrder,
isBuyNftsWithFiatEnabled,
isBuyWithCardPage
])

const handleClose = useCallback(() => setShowAuthorizationModal(false), [
setShowAuthorizationModal
Expand Down

0 comments on commit 1292347

Please sign in to comment.