mirror of
https://git.v0id.ovh/n3wt-innov/n3wt-school.git
synced 2026-01-29 16:03:21 +00:00
feat: Création d'un profile selector [#37,#38]
This commit is contained in:
@ -131,7 +131,6 @@ export default function Layout({
|
||||
if (roleIndex === -1) {
|
||||
roleIndex = 0;
|
||||
}
|
||||
setCurrentRoleIndex(roleIndex);
|
||||
const role = session.user.roles[roleIndex].role_type;
|
||||
setProfileRole(role);
|
||||
}}
|
||||
|
||||
@ -10,7 +10,7 @@ import logger from '@/utils/logger';
|
||||
import { fetchRegisterForms } from '@/app/actions/subscriptionAction';
|
||||
import { fetchUpcomingEvents } from '@/app/actions/planningAction';
|
||||
import { getSession } from 'next-auth/react';
|
||||
import { getCurrentRoleIndex } from '@/store/Store';
|
||||
import { useEstablishment } from '@/context/EstablishmentContext';
|
||||
|
||||
|
||||
// Composant EventCard pour afficher les événements
|
||||
@ -42,14 +42,11 @@ export default function DashboardPage() {
|
||||
|
||||
const [classes, setClasses] = useState([]);
|
||||
const [establishmentId, setEstablishmentId] = useState(null);
|
||||
|
||||
const { selectedEstablishmentId } = useEstablishment();
|
||||
useEffect(() => {
|
||||
getSession()
|
||||
.then(session => {
|
||||
if (session && session.user) {
|
||||
const establishmentId = session.user.roles[getCurrentRoleIndex()].establishment__id;
|
||||
setEstablishmentId(establishmentId);
|
||||
}
|
||||
setEstablishmentId(selectedEstablishmentId);
|
||||
})
|
||||
.catch(err => {
|
||||
logger.error('Error fetching session:', err);
|
||||
|
||||
Reference in New Issue
Block a user