Commit 2721c9f2 authored by FORESTIER Fabien's avatar FORESTIER Fabien
Browse files

Add redirection to login page on 401 error in user profil page

parent 603a2a7f
Pipeline #1801 passed with stages
in 6 minutes
......@@ -97,6 +97,7 @@ export class UserInfoComponent implements OnInit {
message: notificationMessages.userInfo.failedToLoadUserInfo,
},
);
this.handle401(err);
},
);
}
......@@ -146,6 +147,7 @@ export class UserInfoComponent implements OnInit {
message: notificationMessages.userInfo.failedToUpdateUserInfo,
},
);
this.handle401(err);
},
);
}
......@@ -178,8 +180,17 @@ export class UserInfoComponent implements OnInit {
message: notificationMessages.userInfo.errorDeletingAccount,
},
);
this.handle401(err);
},
);
}
// If the error received is an authentication error then redirect to the login page
// because only authenticated users are supposed to access this component
handle401(err) {
if (err && err.status === 401) {
this._router.navigate(['/', AppRoutes.signin.uri]);
}
}
}
......@@ -128,9 +128,17 @@ export class UserPasswordUpdateComponent implements OnInit {
type: 'error',
},
);
this.handle401(err);
},
);
}
}
// If the error received is an authentication error then redirect to the login page
// because only authenticated users are supposed to access this component
handle401(err) {
if (err && err.status === 401) {
this._router.navigate(['/', AppRoutes.signin.uri]);
}
}
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment