import { BK_LOGIN_URL, FR_USERS_LOGIN_URL , FR_ADMIN_HOME_URL, FR_ADMIN_STUDENT_URL, FR_ADMIN_CLASSES_URL, FR_ADMIN_GRADES_URL, FR_ADMIN_PLANNING_URL, FR_ADMIN_TEACHERS_URL, FR_ADMIN_SETTINGS_URL } from '@/utils/Url'; import {mockUser} from "@/data/mockUsersData"; const useFakeData = process.env.NEXT_PUBLIC_USE_FAKE_DATA === 'true'; /** * Disconnects the user after confirming the action. * If `NEXT_PUBLIC_USE_FAKE_DATA` environment variable is set to 'true', it will log a fake disconnect and redirect to the login URL. * Otherwise, it will send a PUT request to the backend to update the user profile and then redirect to the login URL. * * @function * @name disconnect * @returns {void} */ export function disconnect () { if (confirm("\nÊtes-vous sûr(e) de vouloir vous déconnecter ?")) { if (useFakeData) { console.log('Fake disconnect:', mockUser); router.push(`${FR_USERS_LOGIN_URL}`); } else { console.log('Fake disconnect:', mockUser); router.push(`${FR_USERS_LOGIN_URL}`); } } };