Finanzen: nur fuer Admins, Rueckkehrseite fuer die Bankfreigabe

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
ClaudeandClaude Sonnet 5.5 committed 2026-10-01 15:12:18 +00:00
1 parent c910bedcec
commit 0069a62a09
6 files changed
+201 -3

No files matched your search

+20
View File
@@ -0,0 +1,20 @@
import { Navigate } from 'react-router-dom'
import { useAuth } from '../context/AuthContext'
// Nur fuer Admins; wird innerhalb von ProtectedRoute verwendet. Alle anderen landen bei den Tickets.
export default function AdminRoute({ children }) {
const { loading, isAdmin } = useAuth()
if (loading) {
return (
<div className="text-center p-4" style={{ marginTop: 80 }}>
<div className="spinner"></div>
<p>Loading...</p>
</div>
)
}
if (!isAdmin) return <Navigate to="/tickets" replace />
return children
}