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

32 lines
940 B
TypeScript
Raw Normal View History

2023-08-08 23:04:21 +03:00
import { useLayoutEffect } from 'react';
2023-07-25 20:27:29 +03:00
import { useAuth } from '@/context/AuthContext';
import { useConceptNavigation } from '@/context/NagivationContext';
import { TIMEOUT_UI_REFRESH } from '@/utils/constants';
2023-07-15 17:46:19 +03:00
function HomePage() {
const router = useConceptNavigation();
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(() => {
router.push('/manuals');
2023-08-11 12:49:32 +03:00
}, TIMEOUT_UI_REFRESH);
2023-09-02 01:11:27 +03:00
} else {
2023-08-11 12:49:32 +03:00
setTimeout(() => {
router.push('/library');
2023-08-11 12:49:32 +03:00
}, TIMEOUT_UI_REFRESH);
2023-08-08 23:04:21 +03:00
}
}, [router, 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'>
{user?.is_staff ?
<p>
Лендинг находится в разработке. Данная страница видна только пользователям с правами администратора.
</p>: null}
</div>);
2023-07-15 17:46:19 +03:00
}
export default HomePage;