🐛 fix(auth): Implement user redirection to dashboard upon authentication
This commit is contained in:
@@ -8,13 +8,22 @@ import LoginLottie from '@workspace/ui/lotties/login.json';
|
||||
import { useTranslations } from 'next-intl';
|
||||
import Image from 'next/legacy/image';
|
||||
import Link from 'next/link';
|
||||
import { useRouter } from 'next/navigation';
|
||||
import { useEffect } from 'react';
|
||||
import EmailAuthForm from './email/auth-form';
|
||||
|
||||
export default function Page() {
|
||||
const t = useTranslations('auth');
|
||||
const { common } = useGlobalStore();
|
||||
const { common, user } = useGlobalStore();
|
||||
const { site } = common;
|
||||
|
||||
const router = useRouter();
|
||||
useEffect(() => {
|
||||
if (user) {
|
||||
router.replace('/dashboard');
|
||||
}
|
||||
}, [router, user]);
|
||||
|
||||
return (
|
||||
<main className='bg-muted/50 flex h-full min-h-screen items-center'>
|
||||
<div className='flex size-full flex-auto flex-col justify-center lg:flex-row'>
|
||||
|
||||
Reference in New Issue
Block a user