Add Super Admin login routing and wire tenant onboarding to auto-create a location
super_admin is now a real LoginRole, derived from the server's issuperadmin flag (not a client-guessable roleid) — routes exclusively to a new minimal SuperAdminPage, never the merchant console. That page reuses the existing tenant/store/rider onboarding wizard (AdminConsole) rather than duplicating it — its Tenant tab was already calling the right composite endpoint but had nowhere to send location data, and was never actually reachable from anywhere in the app. Now it collects a primary outlet name + business category and sends a nested tenantlocations object, so one submit provisions tenant + active location + admin user instead of leaving the tenant locationless. createTenantUser also moves off the mob API base onto the web one, matching where this is actually called from. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
12
src/App.tsx
12
src/App.tsx
@@ -54,6 +54,7 @@ import StoreDetailView from './components/StoreDetailView';
|
||||
import DispatchHubView from './components/DispatchHubView';
|
||||
import LoginView from './components/LoginView';
|
||||
import UserStorePage from './components/UserStorePage';
|
||||
import SuperAdminPage from './components/SuperAdminPage';
|
||||
import AwaitingApi from './components/AwaitingApi';
|
||||
import ComparisonModal from './components/ComparisonModal';
|
||||
import CatalogueBrowser from './components/CatalogueBrowser';
|
||||
@@ -568,6 +569,17 @@ export default function App() {
|
||||
);
|
||||
}
|
||||
|
||||
// Platform operator, not scoped to any tenant — never sees the merchant
|
||||
// console (dashboard/inventory/catalogue/etc), only tenant onboarding.
|
||||
if (authRole === 'super_admin' && authUser) {
|
||||
return (
|
||||
<Routes>
|
||||
<Route path="/superadmin/*" element={<SuperAdminPage onLogout={handleLogout} user={authUser} />} />
|
||||
<Route path="*" element={<Navigate to="/superadmin/onboarding" replace />} />
|
||||
</Routes>
|
||||
);
|
||||
}
|
||||
|
||||
const AdminConsole = (
|
||||
<div className="min-h-screen bg-[#f8fafc] text-[#0f172a] font-sans antialiased overflow-x-hidden">
|
||||
{/* Navbar segment */}
|
||||
|
||||
Reference in New Issue
Block a user