aboutsummaryrefslogtreecommitdiff
path: root/front-end/src/bootstrap/components/Header.vue
diff options
context:
space:
mode:
authorLibravatar vnugent <public@vaughnnugent.com>2023-12-13 17:58:51 -0500
committerLibravatar vnugent <public@vaughnnugent.com>2023-12-13 17:58:51 -0500
commit4b8ae76132d2342f40cec703b3d5145ea075c451 (patch)
tree62b942b6181261566cd3245ee35cd15a138aabf2 /front-end/src/bootstrap/components/Header.vue
parentb564708f29cf8a709c3e3d981477b2ec8440673e (diff)
log time coming ui and lib updates
Diffstat (limited to 'front-end/src/bootstrap/components/Header.vue')
-rw-r--r--front-end/src/bootstrap/components/Header.vue26
1 files changed, 11 insertions, 15 deletions
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')
}
</script> \ No newline at end of file