fix : reset sidebar state on logout
Add resetSidebar() to useSidebar composable and call it on logout to prevent stale sidebar data after re-login. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -8,9 +8,11 @@
|
||||
definePageMeta({ layout: 'auth' })
|
||||
|
||||
const auth = useAuthStore()
|
||||
const { resetSidebar } = useSidebar()
|
||||
|
||||
onMounted(async () => {
|
||||
await auth.logout()
|
||||
resetSidebar()
|
||||
await navigateTo('/login')
|
||||
})
|
||||
</script>
|
||||
|
||||
@@ -29,11 +29,18 @@ export function useSidebar() {
|
||||
)
|
||||
}
|
||||
|
||||
function resetSidebar() {
|
||||
sections.value = []
|
||||
disabledRoutes.value = []
|
||||
loaded.value = false
|
||||
}
|
||||
|
||||
return {
|
||||
sections,
|
||||
disabledRoutes,
|
||||
loaded,
|
||||
loadSidebar,
|
||||
resetSidebar,
|
||||
isRouteDisabled,
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user