diff --git a/frontend/src/pages/AdminUsersPage.jsx b/frontend/src/pages/AdminUsersPage.jsx index 48ffa2c..aca1b3c 100644 --- a/frontend/src/pages/AdminUsersPage.jsx +++ b/frontend/src/pages/AdminUsersPage.jsx @@ -37,6 +37,12 @@ const AdminUsersPage = () => { is_superuser: false, }); + useEffect(() => { + if (!currentUser) { + window.location.href = '/login'; + } + }, [currentUser]); + const generateInviteLink = async () => { try { setError(''); @@ -102,7 +108,6 @@ const AdminUsersPage = () => { if (String(userId) === String(getUserId(currentUser))) { logout(); - window.location.href = '/login'; return; }