Skip to content

Commit

Permalink
seperated out the useEffect functions
Browse files Browse the repository at this point in the history
  • Loading branch information
Stephen-Gordon committed Apr 10, 2024
1 parent a2712ef commit 720a2c0
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions src/app/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,20 +24,25 @@ export default function HomePage() {
const { zeroDevReady, authenticated } = usePrivySmartAccount();

const { isMobile, userAgentString, userAgent, isStandalone } = useUserAgent();

useEffect(() => {
setTimeout(() => {
if (isStandalone && authenticated) {
router.push('/home');
}

}, 3000);
}, [isStandalone, authenticated]);

useEffect(() => {

setTimeout(() => {
if (isStandalone && authenticated) {
router.push('/home');
}
if (isStandalone && zeroDevReady && !authenticated) {

if (isStandalone && !authenticated) {
router.push('/login');
}

}, 3000)
}, [isStandalone, authenticated, zeroDevReady]);
}, [isStandalone, authenticated]);

const [welcomeMessage, setWelcomeMessage] =
useState<string>('Checking device...');
Expand All @@ -58,6 +63,7 @@ export default function HomePage() {

{/* <Link href='/home'>Home</Link>
<Link href='/home'>login</Link> */}


<AnimatePresence>
{textLoading && (
Expand Down

0 comments on commit 720a2c0

Please sign in to comment.