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

26 lines
575 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-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:25:16 +03:00
navigate('/library?filter=common');
2023-08-08 23:04:21 +03:00
} else if(!user.is_staff) {
2023-08-11 12:25:16 +03:00
navigate('/library?filter=personal');
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 py-2'>
<p>Home page</p>
</div>
);
}
2023-07-25 20:27:29 +03:00
export default HomePage;