Add UI XML files for current and initial app layout
- Created `ui-current.xml` to represent the current state of the app's UI hierarchy. - Created `ui.xml` to represent the initial state of the app's UI hierarchy.
This commit is contained in:
25
plugins/auth-sync.client.js
Normal file
25
plugins/auth-sync.client.js
Normal file
@@ -0,0 +1,25 @@
|
||||
export default defineNuxtPlugin((nuxtApp) => {
|
||||
const authStore = useAuthStore()
|
||||
|
||||
const syncAuthState = async () => {
|
||||
await authStore.checkAuth()
|
||||
}
|
||||
|
||||
nuxtApp.hook('app:mounted', () => {
|
||||
syncAuthState()
|
||||
})
|
||||
|
||||
if (typeof window !== 'undefined') {
|
||||
window.addEventListener('pageshow', (event) => {
|
||||
if (event.persisted) {
|
||||
syncAuthState()
|
||||
}
|
||||
})
|
||||
|
||||
document.addEventListener('visibilitychange', () => {
|
||||
if (document.visibilityState === 'visible') {
|
||||
syncAuthState()
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
Reference in New Issue
Block a user