feat: restructure frontend routes — vendor/tenant persona split

Splits the flat 3-page UI into /vendor/* (platform:admin) and /tenant/*
(all authenticated users) route trees, with stub pages, new API hooks,
updated Layout with persona-aware sidebar, and SpaController forwarding.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
hsiegeln
2026-04-09 21:52:34 +02:00
parent e56e3fca8a
commit bf3aa57274
19 changed files with 329 additions and 496 deletions

View File

@@ -1,9 +1,9 @@
import { useRef } from 'react';
import { Navigate } from 'react-router';
import { Navigate, Outlet } from 'react-router';
import { useLogto } from '@logto/react';
import { Spinner } from '@cameleer/design-system';
export function ProtectedRoute({ children }: { children: React.ReactNode }) {
export function ProtectedRoute({ children }: { children?: React.ReactNode }) {
const { isAuthenticated, isLoading } = useLogto();
// The Logto SDK sets isLoading=true for EVERY async method (getAccessToken, etc.),
// not just initial auth. Only gate on the initial load — once isLoading is false
@@ -23,5 +23,5 @@ export function ProtectedRoute({ children }: { children: React.ReactNode }) {
}
if (!isAuthenticated) return <Navigate to="/login" replace />;
return <>{children}</>;
return children ? <>{children}</> : <Outlet />;
}