Skip to content
This repository has been archived by the owner on Nov 18, 2024. It is now read-only.

Commit

Permalink
reroute user based on role
Browse files Browse the repository at this point in the history
  • Loading branch information
khylpe committed Apr 25, 2024
1 parent a8ee0f9 commit 5510ecf
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion frontend/src/components/logInForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,12 @@ export default function LogInForm() {
if (userData) {
setUser(userData, formData.remember);
message.success('Connexion réussie');
router.push('/'); // * Redirect to the home page
if(userData.role === 'Utilisateur'){
router.push('/profil'); // * Redirect to the home page
}else{

router.push('/dashboard'); // * Redirect to the home page
}
}
} catch (error) {
const axiosError = error as AxiosError;
Expand Down

0 comments on commit 5510ecf

Please sign in to comment.