Skip to content

Commit

Permalink
Prevent token modal from showing if token is still valid
Browse files Browse the repository at this point in the history
  • Loading branch information
SidharthK2 committed Jul 11, 2024
1 parent bb60994 commit 2e18823
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
3 changes: 1 addition & 2 deletions src/components/Layout/WalletDrawer/Connectors.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,13 @@ const Connectors = ({ openWalletDrawer, handleRedirect }: ConnectorsProps) => {
posthog.capture('login_success', {
address: data.account,
})
openSignTokenModal()
},
})

async function triggerSignToken() {
const storedToken = await fetchStoredToken()
if (storedToken) {
console.error('Token already exists')
console.warn('Token already exists')
closeSignTokenModal()
handleRedirect()
return
Expand Down
10 changes: 6 additions & 4 deletions src/pages/login/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React from 'react'
import React, { useEffect } from 'react'
import { Box, Container, Heading } from '@chakra-ui/react'
import Connectors from '@/components/Layout/WalletDrawer/Connectors'
import { useRouter } from 'next/router'
Expand All @@ -25,9 +25,11 @@ const Login = () => {
}
}

if (userAddress && token) {
handleRedirect()
}
useEffect(() => {
if (userAddress && token) {
handleRedirect()
}
}, [userAddress, token])

return (
<>
Expand Down

0 comments on commit 2e18823

Please sign in to comment.