fix: auth race condition on refresh, section edit dialog, time slot duplicate, autocomplete disable
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -4,27 +4,53 @@ import ScrollToTop from '@core/components/ScrollToTop.vue'
|
||||
import initCore from '@core/initCore'
|
||||
import { initConfigStore, useConfigStore } from '@core/stores/config'
|
||||
import { hexToRgb } from '@core/utils/colorConverter'
|
||||
import { useMe } from '@/composables/api/useAuth'
|
||||
import { useAuthStore } from '@/stores/useAuthStore'
|
||||
import { useNotificationStore } from '@/stores/useNotificationStore'
|
||||
|
||||
const { global } = useTheme()
|
||||
|
||||
// ℹ️ Sync current theme with initial loader theme
|
||||
initCore()
|
||||
initConfigStore()
|
||||
|
||||
const configStore = useConfigStore()
|
||||
const authStore = useAuthStore()
|
||||
const notificationStore = useNotificationStore()
|
||||
|
||||
// Hydrate auth store on page load (token survives in localStorage, user data does not)
|
||||
useMe()
|
||||
// Validate stored token on app startup — must complete before rendering protected content
|
||||
authStore.initialize()
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<VLocaleProvider :rtl="configStore.isAppRTL">
|
||||
<!-- ℹ️ This is required to set the background color of active nav link based on currently active global theme's primary -->
|
||||
<VApp :style="`--v-global-theme-primary: ${hexToRgb(global.current.value.colors.primary)}`">
|
||||
<RouterView />
|
||||
<!-- Show loading state while validating auth token -->
|
||||
<template v-if="!authStore.isInitialized">
|
||||
<div class="d-flex align-center justify-center" style="min-height: 100vh;">
|
||||
<VProgressCircular indeterminate color="primary" size="48" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<ScrollToTop />
|
||||
<!-- Only render app shell after auth is resolved -->
|
||||
<template v-else>
|
||||
<RouterView />
|
||||
<ScrollToTop />
|
||||
</template>
|
||||
</VApp>
|
||||
|
||||
<!-- Global notification snackbar -->
|
||||
<VSnackbar
|
||||
v-model="notificationStore.visible"
|
||||
:color="notificationStore.type"
|
||||
:timeout="notificationStore.timeout"
|
||||
location="top end"
|
||||
>
|
||||
{{ notificationStore.message }}
|
||||
|
||||
<template #actions>
|
||||
<VBtn variant="text" @click="notificationStore.hide()">
|
||||
Close
|
||||
</VBtn>
|
||||
</template>
|
||||
</VSnackbar>
|
||||
</VLocaleProvider>
|
||||
</template>
|
||||
|
||||
Reference in New Issue
Block a user