mirror of
https://git.v0id.ovh/n3wt-innov/n3wt-school.git
synced 2026-01-29 07:53:23 +00:00
fix: correction de l'ouverture du dashbord [#39]
This commit is contained in:
@ -16,10 +16,10 @@ import { login } from '@/app/actions/authAction';
|
||||
import { getSession } from 'next-auth/react';
|
||||
import { useCsrfToken } from '@/context/CsrfContext'; // Importez le hook useCsrfToken
|
||||
import logger from '@/utils/logger';
|
||||
import { useSession } from 'next-auth/react';
|
||||
import ProfileSelector from '@/components/ProfileSelector'; // Importez le composant ProfileSelector
|
||||
import { RIGHTS } from '@/utils/rights';
|
||||
import { setCurrentRoleIndex } from '@/store/Store';
|
||||
|
||||
const useFakeData = process.env.NEXT_PUBLIC_USE_FAKE_DATA === 'true';
|
||||
|
||||
export default function Page() {
|
||||
const searchParams = useSearchParams();
|
||||
@ -63,9 +63,12 @@ export default function Page() {
|
||||
if (roles.length > 0) {
|
||||
// Redirection en fonction du rôle
|
||||
// Ne pas désactiver le loader avant la redirection
|
||||
if (roles[0].role_type === 1) {
|
||||
const currentRoleIndex = 0;
|
||||
setCurrentRoleIndex(currentRoleIndex);
|
||||
const role = roles[currentRoleIndex].role_type;
|
||||
if (role === RIGHTS.ADMIN || role === RIGHTS.TEACHER) {
|
||||
router.push(FE_ADMIN_SUBSCRIPTIONS_URL);
|
||||
} else if (roles[0].role_type === 2) {
|
||||
} else if (role === RIGHTS.PARENT) {
|
||||
router.push(FE_PARENTS_HOME_URL);
|
||||
} else {
|
||||
setIsLoading(false);
|
||||
|
||||
Reference in New Issue
Block a user