mirror of
https://git.v0id.ovh/n3wt-innov/n3wt-school.git
synced 2026-01-29 16:03:21 +00:00
chore: Initial Commit
feat: Gestion des inscriptions [#1] feat(frontend): Création des vues pour le paramétrage de l'école [#2] feat: Gestion du login [#6] fix: Correction lors de la migration des modèle [#8] feat: Révision du menu principal [#9] feat: Ajout d'un footer [#10] feat: Création des dockers compose pour les environnements de développement et de production [#12] doc(ci): Mise en place de Husky et d'un suivi de version automatique [#14]
This commit is contained in:
39
Front-End/src/app/lib/actions.js
Normal file
39
Front-End/src/app/lib/actions.js
Normal file
@ -0,0 +1,39 @@
|
||||
|
||||
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}`);
|
||||
}
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user