ConceptPortal-public/rsconcept/frontend/src/pages/HomePage.tsx
2023-12-26 14:23:51 +03:00

32 lines
933 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 { useAuth } from '@/context/AuthContext';
import { useConceptNavigation } from '@/context/NavigationContext';
import { TIMEOUT_UI_REFRESH } from '@/utils/constants';
function HomePage() {
const router = useConceptNavigation();
const { user } = useAuth();
useLayoutEffect(() => {
if (!user) {
setTimeout(() => {
router.push('/manuals');
}, TIMEOUT_UI_REFRESH);
} else {
setTimeout(() => {
router.push('/library');
}, TIMEOUT_UI_REFRESH);
}
}, [router, user])
return (
<div className='flex flex-col items-center justify-center px-4 py-2'>
{user?.is_staff ?
<p>
Лендинг находится в разработке. Данная страница видна только пользователям с правами администратора.
</p>: null}
</div>);
}
export default HomePage;