ConceptPortal-public/rsconcept/frontend/src/pages/HomePage.tsx

31 lines
899 B
TypeScript
Raw Normal View History

2023-08-08 23:04:21 +03:00
import { useLayoutEffect } from 'react';
import { useNavigate } from 'react-router-dom';
2023-07-25 20:27:29 +03:00
import { useAuth } from '../context/AuthContext';
2023-08-11 12:49:32 +03:00
import { TIMEOUT_UI_REFRESH } from '../utils/constants';
2023-07-15 17:46:19 +03:00
function HomePage() {
const navigate = useNavigate();
2023-07-25 20:27:29 +03:00
const { user } = useAuth();
2023-08-08 23:04:21 +03:00
useLayoutEffect(() => {
if (!user) {
2023-08-11 12:49:32 +03:00
setTimeout(() => {
2023-08-23 22:57:25 +03:00
navigate('/manuals');
2023-08-11 12:49:32 +03:00
}, TIMEOUT_UI_REFRESH);
2023-08-08 23:04:21 +03:00
} else if(!user.is_staff) {
2023-08-11 12:49:32 +03:00
setTimeout(() => {
2023-08-27 15:39:49 +03:00
navigate('/library');
2023-08-11 12:49:32 +03:00
}, TIMEOUT_UI_REFRESH);
2023-08-08 23:04:21 +03:00
}
}, [navigate, user])
2023-07-25 20:27:29 +03:00
2023-07-15 17:46:19 +03:00
return (
<div className='flex flex-col items-center justify-center w-full px-4 py-2'>
2023-08-23 22:57:25 +03:00
<p>Лендинг находится в разработке. Данная страница видна только пользователям с правами администратора.</p>
2023-07-15 17:46:19 +03:00
</div>
);
}
2023-07-25 20:27:29 +03:00
export default HomePage;