From 0036e7302d56f25adc5771613914afa31d58641e Mon Sep 17 00:00:00 2001 From: IRBorisov <8611739+IRBorisov@users.noreply.github.com> Date: Fri, 11 Aug 2023 12:49:32 +0300 Subject: [PATCH] Update HomePage.tsx --- rsconcept/frontend/src/pages/HomePage.tsx | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/rsconcept/frontend/src/pages/HomePage.tsx b/rsconcept/frontend/src/pages/HomePage.tsx index 9927e87f..19b7429e 100644 --- a/rsconcept/frontend/src/pages/HomePage.tsx +++ b/rsconcept/frontend/src/pages/HomePage.tsx @@ -2,6 +2,7 @@ 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(); @@ -9,9 +10,13 @@ function HomePage() { useLayoutEffect(() => { if (!user) { - navigate('/library?filter=common'); + setTimeout(() => { + navigate('/library?filter=common'); + }, TIMEOUT_UI_REFRESH); } else if(!user.is_staff) { - navigate('/library?filter=personal'); + setTimeout(() => { + navigate('/library?filter=personal'); + }, TIMEOUT_UI_REFRESH); } }, [navigate, user])