mirror of
https://github.com/IRBorisov/ConceptPortal.git
synced 2025-06-26 13:00:39 +03:00
Update HomePage.tsx
This commit is contained in:
parent
b5da4091d8
commit
0036e7302d
|
@ -2,6 +2,7 @@ import { useLayoutEffect } from 'react';
|
||||||
import { useNavigate } from 'react-router-dom';
|
import { useNavigate } from 'react-router-dom';
|
||||||
|
|
||||||
import { useAuth } from '../context/AuthContext';
|
import { useAuth } from '../context/AuthContext';
|
||||||
|
import { TIMEOUT_UI_REFRESH } from '../utils/constants';
|
||||||
|
|
||||||
function HomePage() {
|
function HomePage() {
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
|
@ -9,9 +10,13 @@ function HomePage() {
|
||||||
|
|
||||||
useLayoutEffect(() => {
|
useLayoutEffect(() => {
|
||||||
if (!user) {
|
if (!user) {
|
||||||
navigate('/library?filter=common');
|
setTimeout(() => {
|
||||||
|
navigate('/library?filter=common');
|
||||||
|
}, TIMEOUT_UI_REFRESH);
|
||||||
} else if(!user.is_staff) {
|
} else if(!user.is_staff) {
|
||||||
navigate('/library?filter=personal');
|
setTimeout(() => {
|
||||||
|
navigate('/library?filter=personal');
|
||||||
|
}, TIMEOUT_UI_REFRESH);
|
||||||
}
|
}
|
||||||
}, [navigate, user])
|
}, [navigate, user])
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user