feat: reorganize machine skeleton pages

This commit is contained in:
Matthieu
2025-09-29 15:05:54 +02:00
parent a78938a4d1
commit 43b615ac3e
8 changed files with 187 additions and 1381 deletions

View File

@@ -1,23 +1,24 @@
import { useProfileSession } from '#imports'
import { useProfileSession } from "#imports";
export default defineNuxtRouteMiddleware(async (to) => {
const { ensureSession, fetchCurrentProfile, activeProfile } = useProfileSession()
await ensureSession()
const { ensureSession, fetchCurrentProfile, activeProfile } =
useProfileSession();
await ensureSession();
const rawPath = to?.path ?? ''
const normalizedPath = rawPath.startsWith('/') ? rawPath : `/${rawPath}`
const fullPath = to?.fullPath ?? normalizedPath
const routeName = typeof to?.name === 'string' ? to.name : ''
const rawPath = to?.path ?? "";
const normalizedPath = rawPath.startsWith("/") ? rawPath : `/${rawPath}`;
const fullPath = to?.fullPath ?? normalizedPath;
const routeName = typeof to?.name === "string" ? to.name : "";
const isProfilesRoute =
normalizedPath.startsWith('/profiles') ||
fullPath.startsWith('/profiles') ||
routeName.startsWith('profiles')
normalizedPath.startsWith("/profiles") ||
fullPath.startsWith("/profiles") ||
routeName.startsWith("profiles");
if (process.client && !activeProfile.value) {
await fetchCurrentProfile()
await fetchCurrentProfile();
}
if (process.client && !activeProfile.value && !isProfilesRoute) {
return navigateTo('/profiles')
return navigateTo("/profiles");
}
})
});