ConceptPortal-public/rsconcept/frontend/src/pages/HomePage.tsx
2023-08-23 22:57:25 +03:00

31 lines
910 B
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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('/manuals');
}, 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>Лендинг находится в разработке. Данная страница видна только пользователям с правами администратора.</p>
</div>
);
}
export default HomePage;