fix: vendor user now lands on /vendor/tenants after login
LandingRedirect component checks scopes — platform:admin goes to vendor console, others go to tenant dashboard. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -5,6 +5,7 @@ import { ProtectedRoute } from './auth/ProtectedRoute';
|
|||||||
import { OrgResolver } from './auth/OrgResolver';
|
import { OrgResolver } from './auth/OrgResolver';
|
||||||
import { Layout } from './components/Layout';
|
import { Layout } from './components/Layout';
|
||||||
import { RequireScope } from './components/RequireScope';
|
import { RequireScope } from './components/RequireScope';
|
||||||
|
import { useScopes } from './auth/useScopes';
|
||||||
|
|
||||||
import { VendorTenantsPage } from './pages/vendor/VendorTenantsPage';
|
import { VendorTenantsPage } from './pages/vendor/VendorTenantsPage';
|
||||||
import { CreateTenantPage } from './pages/vendor/CreateTenantPage';
|
import { CreateTenantPage } from './pages/vendor/CreateTenantPage';
|
||||||
@@ -15,6 +16,14 @@ import { OidcConfigPage } from './pages/tenant/OidcConfigPage';
|
|||||||
import { TeamPage } from './pages/tenant/TeamPage';
|
import { TeamPage } from './pages/tenant/TeamPage';
|
||||||
import { SettingsPage } from './pages/tenant/SettingsPage';
|
import { SettingsPage } from './pages/tenant/SettingsPage';
|
||||||
|
|
||||||
|
function LandingRedirect() {
|
||||||
|
const scopes = useScopes();
|
||||||
|
if (scopes.has('platform:admin')) {
|
||||||
|
return <Navigate to="/vendor/tenants" replace />;
|
||||||
|
}
|
||||||
|
return <Navigate to="/tenant" replace />;
|
||||||
|
}
|
||||||
|
|
||||||
export function AppRouter() {
|
export function AppRouter() {
|
||||||
return (
|
return (
|
||||||
<Routes>
|
<Routes>
|
||||||
@@ -47,8 +56,8 @@ export function AppRouter() {
|
|||||||
<Route path="/tenant/team" element={<TeamPage />} />
|
<Route path="/tenant/team" element={<TeamPage />} />
|
||||||
<Route path="/tenant/settings" element={<SettingsPage />} />
|
<Route path="/tenant/settings" element={<SettingsPage />} />
|
||||||
|
|
||||||
{/* Default redirect */}
|
{/* Default redirect — vendor goes to /vendor/tenants, customer to /tenant */}
|
||||||
<Route index element={<Navigate to="/tenant" replace />} />
|
<Route index element={<LandingRedirect />} />
|
||||||
</Route>
|
</Route>
|
||||||
</Route>
|
</Route>
|
||||||
</Route>
|
</Route>
|
||||||
|
|||||||
Reference in New Issue
Block a user