Remove embedded admin UI and redirect admins to standalone ops app.
Extract admin routes from the main SPA, add plaza-api bootstrap module, and track ops pnpm lockfile. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -1,23 +0,0 @@
|
||||
import { useEffect } from 'react';
|
||||
import { useNavigate } from 'react-router-dom';
|
||||
import type { PortalUser } from '../types';
|
||||
|
||||
export function RequireAdmin({
|
||||
user,
|
||||
children,
|
||||
}: {
|
||||
user: PortalUser | null;
|
||||
children: React.ReactNode;
|
||||
}) {
|
||||
const navigate = useNavigate();
|
||||
const allowed = user?.role === 'admin';
|
||||
|
||||
useEffect(() => {
|
||||
if (!allowed) {
|
||||
navigate('/', { replace: true });
|
||||
}
|
||||
}, [allowed, navigate]);
|
||||
|
||||
if (!allowed) return null;
|
||||
return children;
|
||||
}
|
||||
Reference in New Issue
Block a user