22import type { AuthState } from ' ./stores'
33import Clarity from ' @microsoft/clarity'
44import { Zap } from ' lucide-vue-next'
5- import { onMounted , ref } from ' vue'
5+ import { onMounted , ref , watch } from ' vue'
66import { useI18n } from ' vue-i18n'
77import { useRouter } from ' vue-router'
88import AppSidebar from ' @/components/AppSidebar.vue'
@@ -12,13 +12,14 @@ import { SidebarInset, SidebarProvider, SidebarTrigger } from '@/components/ui/s
1212import { Toaster } from ' @/components/ui/sonner'
1313import { useThemeStore } from ' @/stores/theme'
1414import ActionHandler from ' @/views/ActionHandler.vue'
15- import { useAuthStore } from ' ./stores'
15+ import { useAuthStore , useServiceStore } from ' ./stores'
1616import ' vue-sonner/style.css'
1717
1818const { t } = useI18n ()
1919const authStore = useAuthStore ()
2020const { replace, currentRoute } = useRouter ()
2121const themeStore = useThemeStore ()
22+ const serviceStore = useServiceStore ()
2223
2324const authState = ref <AuthState | null >(null )
2425const isCheckingAuth = ref (true )
@@ -33,6 +34,12 @@ onMounted(async () => {
3334 setTimeout (() => replace (currentRoute .value .path ), 100 )
3435 Clarity .init (' sx60zbxtfz' )
3536})
37+
38+ watch (() => serviceStore .serverConnected , async (connected ) => {
39+ if (connected ) {
40+ authState .value = await authStore .checkAuth ()
41+ }
42+ })
3643 </script >
3744
3845<template >
0 commit comments