export default defineNuxtRouteMiddleware((to, from) => { // Skip on server side - let client handle auth if (process.server) { return; } const authStore = useAuthStore(); // Restore session if not authenticated if (!authStore.isAuthenticated) { authStore.checkAuth(); } // Check if user is admin if (!authStore.isAdmin) { return navigateTo('/login'); } });