style: fix linting issues met Prettier
This commit is contained in:
parent
2578555ace
commit
868c5d9afe
2 changed files with 4 additions and 3 deletions
|
@ -138,7 +138,7 @@ const router = createRouter({
|
||||||
router.beforeEach(async (to, _from, next) => {
|
router.beforeEach(async (to, _from, next) => {
|
||||||
// Verify if user is logged in before accessing certain routes
|
// Verify if user is logged in before accessing certain routes
|
||||||
if (to.meta.requiresAuth) {
|
if (to.meta.requiresAuth) {
|
||||||
if (!authService.isLoggedIn.value && !await authService.loadUser()) {
|
if (!authService.isLoggedIn.value && !(await authService.loadUser())) {
|
||||||
next("/login");
|
next("/login");
|
||||||
} else {
|
} else {
|
||||||
next();
|
next();
|
||||||
|
|
|
@ -40,9 +40,10 @@ async function loadUser(): Promise<User | null> {
|
||||||
|
|
||||||
const userManager = (await getUserManagers())[activeRole];
|
const userManager = (await getUserManagers())[activeRole];
|
||||||
let user = await userManager.getUser(); // Load the user from the local storage.
|
let user = await userManager.getUser(); // Load the user from the local storage.
|
||||||
if (!user) { // If the user is not in the local storage, he could still be authenticated in Keycloak.
|
if (!user) {
|
||||||
|
// If the user is not in the local storage, he could still be authenticated in Keycloak.
|
||||||
try {
|
try {
|
||||||
user = await userManager.signinSilent()
|
user = await userManager.signinSilent();
|
||||||
} catch (e: unknown) {
|
} catch (e: unknown) {
|
||||||
// When the user was previously logged in and then logged out, signinSilent throws an error.
|
// When the user was previously logged in and then logged out, signinSilent throws an error.
|
||||||
// In that case, the user is not authenticated anymore, so we set him to null.
|
// In that case, the user is not authenticated anymore, so we set him to null.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue