Audit activité utilisateurs
This commit is contained in:
1 parent
f54d352b7f
commit
a5b4f3e721
10 files changed
+528
-21
No files matched your search
@@ -371,9 +371,9 @@ function CreateUserModal({ open, onClose, onCreated }) {
|
||||
|
||||
// ── Composant principal ────────────────────────────────────────────────────
|
||||
export default function UsersSection({ currentUserId }) {
|
||||
const [users, setUsers] = useState([]);
|
||||
const [loading, setLoading] = useState(true);
|
||||
const [err, setErr] = useState(null);
|
||||
const [users, setUsers] = useState([]);
|
||||
const [initialLoading, setInitialLoading] = useState(true);
|
||||
const [err, setErr] = useState(null);
|
||||
const [confirmAction, setConfirmAction] = useState(null);
|
||||
const [showCreate, setShowCreate] = useState(false);
|
||||
const [showInvite, setShowInvite] = useState(false);
|
||||
@@ -386,13 +386,14 @@ export default function UsersSection({ currentUserId }) {
|
||||
const [page, setPage] = useState(1);
|
||||
const [pageSize, setPageSize] = useState(10);
|
||||
|
||||
const load = useCallback(async () => {
|
||||
try { setLoading(true); setUsers(await api.get('/admin/users')); }
|
||||
const load = useCallback(async (initial = false) => {
|
||||
if (initial) setInitialLoading(true);
|
||||
try { setUsers(await api.get('/admin/users')); }
|
||||
catch (e) { setErr(e.message); }
|
||||
finally { setLoading(false); }
|
||||
finally { if (initial) setInitialLoading(false); }
|
||||
}, []);
|
||||
|
||||
useEffect(() => { load(); }, [load]);
|
||||
useEffect(() => { load(true); }, [load]);
|
||||
useEffect(() => { setPage(1); }, [search, filterStatus, filterRole]);
|
||||
useEffect(() => {
|
||||
if (!openMenu) return;
|
||||
@@ -514,7 +515,7 @@ export default function UsersSection({ currentUserId }) {
|
||||
|
||||
const today = new Date().toISOString().slice(0, 10);
|
||||
|
||||
if (loading) return <p style={{ color: 'var(--text-muted)' }}>Chargement…</p>;
|
||||
if (initialLoading) return <p style={{ color: 'var(--text-muted)' }}>Chargement…</p>;
|
||||
if (err) return <p style={{ color: '#ef4444' }}>{err}</p>;
|
||||
|
||||
return (
|
||||
|
||||
Reference in new issue
Block a user