mirror of
https://gitlab.com/mbugroup/lti-web-client.git
synced 2026-05-25 15:55:48 +00:00
chore: wrap router.replace in useEffect
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
'use client';
|
'use client';
|
||||||
|
|
||||||
|
import { useEffect } from 'react';
|
||||||
import { usePathname, useRouter } from 'next/navigation';
|
import { usePathname, useRouter } from 'next/navigation';
|
||||||
import { useAuth } from '@/services/hooks/useAuth';
|
import { useAuth } from '@/services/hooks/useAuth';
|
||||||
import { redirectToSSO } from '@/lib/auth-helper';
|
import { redirectToSSO } from '@/lib/auth-helper';
|
||||||
@@ -10,9 +11,11 @@ export default function Home() {
|
|||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const pathname = usePathname();
|
const pathname = usePathname();
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
if (pathname === '/') {
|
if (pathname === '/') {
|
||||||
router.replace('/dashboard');
|
router.replace('/dashboard');
|
||||||
}
|
}
|
||||||
|
}, [pathname]);
|
||||||
|
|
||||||
if (isLoadingUser) {
|
if (isLoadingUser) {
|
||||||
return (
|
return (
|
||||||
|
|||||||
Reference in New Issue
Block a user