Skip to content

Commit

Permalink
fix(setup): correctly redirect to home after login
Browse files Browse the repository at this point in the history
  • Loading branch information
jjramirezn committed Jan 15, 2025
1 parent bd007b3 commit 751d0cf
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/components/Setup/Views/Welcome.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,20 @@ import { useToast } from '@/components/0_Bruddle/Toast'
import { useZeroDev } from '@/context/walletContext/zeroDevContext.context'
import { useSetupFlow } from '@/hooks/useSetupFlow'
import { useRouter } from 'next/navigation'
import { useEffect } from 'react'

const WelcomeStep = () => {
const { handleNext } = useSetupFlow()
const { handleLogin, isLoggingIn } = useZeroDev()
const { handleLogin, isLoggingIn, isKernelClientReady } = useZeroDev()
const { push } = useRouter()
const toast = useToast()

useEffect(() => {
if (isKernelClientReady) {
push('/home')
}
}, [isKernelClientReady])

return (
<Card className="border-0">
<Card.Content className="space-y-4 p-0">
Expand All @@ -20,9 +27,7 @@ const WelcomeStep = () => {
loading={isLoggingIn}
variant="transparent-dark"
onClick={() => {
handleLogin()
.then(() => push('/home'))
.catch((_e) => toast.error('Error logging in'))
handleLogin().catch((_e) => toast.error('Error logging in'))
}}
>
Login
Expand Down

0 comments on commit 751d0cf

Please sign in to comment.