export default defineNuxtRouteMiddleware(async () => {
  const auth = useAuthStore()

  if (!auth.checked) {
    await auth.ensureSession()
  }

  if (!auth.user?.hasLeaveRecapAccess) {
    return navigateTo('/')
  }
})
