mirror of
https://gitlab.com/mbugroup/lti-web-client.git
synced 2026-05-20 13:32:00 +00:00
fix: redirect to dashboard if pathname is in root path
This commit is contained in:
+4
-3
@@ -1,7 +1,7 @@
|
|||||||
'use client';
|
'use client';
|
||||||
|
|
||||||
import { useEffect } from 'react';
|
import { useEffect } from 'react';
|
||||||
import { 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';
|
||||||
|
|
||||||
@@ -9,10 +9,11 @@ export default function Home() {
|
|||||||
const { user, isLoadingUser } = useAuth();
|
const { user, isLoadingUser } = useAuth();
|
||||||
|
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
const pathname = usePathname();
|
||||||
|
|
||||||
useEffect(() => {
|
if (pathname === '/') {
|
||||||
router.replace('/dashboard');
|
router.replace('/dashboard');
|
||||||
}, [user, isLoadingUser]);
|
}
|
||||||
|
|
||||||
if (isLoadingUser) {
|
if (isLoadingUser) {
|
||||||
return (
|
return (
|
||||||
|
|||||||
Reference in New Issue
Block a user