Skip to content

Commit

Permalink
feat(fe:FSADT1-1502): Adjust logout behavior (#1167)
Browse files Browse the repository at this point in the history
  • Loading branch information
mamartinezmejia authored Sep 18, 2024
1 parent 5b7500d commit c9ab307
Showing 1 changed file with 17 additions and 5 deletions.
22 changes: 17 additions & 5 deletions frontend/src/components/MainHeaderComponent.vue
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ const session = instance?.appContext.config.globalProperties.$session;
const logout = () => {
session?.logOut();
}
};
const route = useRoute();
Expand All @@ -98,14 +98,26 @@ const onClickLogout = () => {
};
const headerBarButtonsSize = computed(() =>
isSmallScreen.value || isMediumScreen.value ? "lg" : "sm",
isSmallScreen.value || isMediumScreen.value ? "lg" : "sm"
);
const logoutBtnKind = computed(() =>
isSmallScreen.value || isMediumScreen.value ? "ghost" : "tertiary",
isSmallScreen.value || isMediumScreen.value ? "ghost" : "tertiary"
);
const userHasAuthority = ["CLIENT_EDITOR", "CLIENT_ADMIN"].some((authority) =>
ForestClientUserSession.authorities.includes(authority)
);
const userHasAuthority = ["CLIENT_EDITOR", "CLIENT_ADMIN"].some(authority => ForestClientUserSession.authorities.includes(authority));
const handleLogoutClick = (event) => {
event.preventDefault();
if (route.name === "staff-form") {
logoutModalActive.value = true;
} else {
logout();
}
};
</script>

<template>
Expand Down Expand Up @@ -206,7 +218,7 @@ const userHasAuthority = ["CLIENT_EDITOR", "CLIENT_ADMIN"].some(authority => For
<div class="grouping-21" id="panel-content--links">
<cds-side-nav-items>
<cds-side-nav-link title="Options" class="unbolded side-nav-link--non-link" />
<cds-side-nav-link href="#" title="Logout" @click.prevent="logoutModalActive = true">
<cds-side-nav-link href="#" title="Logout" @click.prevent="handleLogoutClick">
<Logout16 slot="title-icon" />
</cds-side-nav-link>
</cds-side-nav-items>
Expand Down

0 comments on commit c9ab307

Please sign in to comment.