export default defineNuxtRouteMiddleware((to, from) => {
    const { status, data } = useAuth();

    if (status.value !== 'authenticated') {
        return navigateTo('/auth/login?callbackUrl=' + to.fullPath);
    }

    if (!data.value?.user?.is_admin) {
        return navigateTo('/');
    }
});
