mirror of
https://github.com/IRBorisov/ConceptPortal.git
synced 2025-06-26 21:10:38 +03:00
31 lines
746 B
TypeScript
31 lines
746 B
TypeScript
import { useLayoutEffect } from 'react';
|
|
import { useNavigate } from 'react-router-dom';
|
|
|
|
import { useAuth } from '../context/AuthContext';
|
|
import { TIMEOUT_UI_REFRESH } from '../utils/constants';
|
|
|
|
function HomePage() {
|
|
const navigate = useNavigate();
|
|
const { user } = useAuth();
|
|
|
|
useLayoutEffect(() => {
|
|
if (!user) {
|
|
setTimeout(() => {
|
|
navigate('/library?filter=common');
|
|
}, TIMEOUT_UI_REFRESH);
|
|
} else if(!user.is_staff) {
|
|
setTimeout(() => {
|
|
navigate('/library?filter=personal');
|
|
}, TIMEOUT_UI_REFRESH);
|
|
}
|
|
}, [navigate, user])
|
|
|
|
return (
|
|
<div className='flex flex-col items-center justify-center w-full py-2'>
|
|
<p>Home page</p>
|
|
</div>
|
|
);
|
|
}
|
|
|
|
export default HomePage;
|