mirror of
https://github.com/pacnpal/thrilltrack-explorer.git
synced 2025-12-23 11:11:14 -05:00
Fix AdminContact loading state
This commit is contained in:
@@ -87,7 +87,7 @@ interface EmailThread {
|
||||
export default function AdminContact() {
|
||||
const queryClient = useQueryClient();
|
||||
const { theme } = useTheme();
|
||||
const { isAdmin } = useUserRole();
|
||||
const { isAdmin, loading: rolesLoading } = useUserRole();
|
||||
const [statusFilter, setStatusFilter] = useState<string>('all');
|
||||
const [categoryFilter, setCategoryFilter] = useState<string>('all');
|
||||
const [searchQuery, setSearchQuery] = useState('');
|
||||
@@ -259,7 +259,16 @@ export default function AdminContact() {
|
||||
return cat?.label || category;
|
||||
};
|
||||
|
||||
// Admin-only access check (after all hooks)
|
||||
// Show loading state while roles are being fetched
|
||||
if (rolesLoading) {
|
||||
return (
|
||||
<div className="flex items-center justify-center min-h-screen">
|
||||
<p className="text-muted-foreground">Loading...</p>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
// Admin-only access check (after loading complete)
|
||||
if (!isAdmin()) {
|
||||
return (
|
||||
<div className="flex items-center justify-center min-h-screen">
|
||||
|
||||
Reference in New Issue
Block a user