From 4b8ae76132d2342f40cec703b3d5145ea075c451 Mon Sep 17 00:00:00 2001 From: vnugent Date: Wed, 13 Dec 2023 17:58:51 -0500 Subject: log time coming ui and lib updates --- front-end/src/bootstrap/components/Header.vue | 26 +++++++++++--------------- 1 file changed, 11 insertions(+), 15 deletions(-) (limited to 'front-end/src/bootstrap/components/Header.vue') diff --git a/front-end/src/bootstrap/components/Header.vue b/front-end/src/bootstrap/components/Header.vue index 8ea2240..43a805b 100644 --- a/front-end/src/bootstrap/components/Header.vue +++ b/front-end/src/bootstrap/components/Header.vue @@ -78,18 +78,21 @@ import { debounce, find } from 'lodash-es' import { useElementSize, onClickOutside, useElementHover } from '@vueuse/core' import { computed, ref, toRefs } from 'vue' -import { useSession, useUser, useEnvSize, apiCall } from '@vnuge/vnlib.browser' +import { useEnvSize } from '@vnuge/vnlib.browser' import { RouteLocation, useRouter } from 'vue-router'; +import { storeToRefs } from 'pinia'; +import { useStore } from '../../store'; +const emit = defineEmits(['logout']) const props = defineProps<{ - siteTitle: string, routes: RouteLocation[] }>() -const { siteTitle, routes } = toRefs(props) +const { routes } = toRefs(props) + +const store = useStore(); +const { loggedIn, siteTitle } = storeToRefs(store); -const { loggedIn } = useSession() -const { userName, logout } = useUser() const { headerHeight } = useEnvSize() //Get the router for navigation @@ -105,7 +108,7 @@ const dropMenuSize = useElementSize(userDrop) const sideMenuSize = useElementSize(sideMenu) const userMenuHovered = useElementHover(userMenu) -const uname = computed(() => userName.value || 'Visitor') +const uname = computed(() => (store as any).userName || 'Visitor') const sideMenuStyle = computed(() => { // Side menu should be the exact height of the page and under the header, // So menu height is the height of the page minus the height of the header @@ -148,15 +151,8 @@ const gotoRoute = (route : string) =>{ } const OnLogout = () =>{ - apiCall(async ({ toaster }) => { - await logout() - toaster.general.success({ - id: 'logout-success', - title: 'Success', - text: 'You have been logged out', - duration: 5000 - }) - }) + //Emit logout event + emit('logout') } \ No newline at end of file -- cgit