export default defineNuxtRouteMiddleware((to) => {
  if (to.meta.public) return

  const { $pinia } = useNuxtApp()
  if (import.meta.client) {
    const userStore = useUserStore($pinia)
    if (!userStore.isAuthenticated) {
      return navigateTo('/auth/login')
    }
  }
})
