Portal/rsconcept/frontend/src/features/home/home-page.tsx

19 lines
552 B
TypeScript
Raw Normal View History

import { urls, useConceptNavigation } from '@/app';
import { useAuthSuspense } from '@/features/auth';
2025-02-12 21:36:03 +03:00
2025-03-13 20:20:59 +03:00
import { PARAMETER } from '@/utils/constants';
2025-02-19 23:29:45 +03:00
export function HomePage() {
2024-06-07 20:17:03 +03:00
const router = useConceptNavigation();
const { isAnonymous } = useAuthSuspense();
2024-06-07 20:17:03 +03:00
2025-02-15 18:32:37 +03:00
if (isAnonymous) {
2025-03-13 20:20:59 +03:00
// Note: Timeout is needed to let router initialize
setTimeout(() => router.replace({ path: urls.login }), PARAMETER.minimalTimeout);
2025-02-15 18:32:37 +03:00
} else {
2025-03-13 20:20:59 +03:00
setTimeout(() => router.replace({ path: urls.library }), PARAMETER.minimalTimeout);
2025-02-15 18:32:37 +03:00
}
2024-06-07 20:17:03 +03:00
2025-02-15 18:32:37 +03:00
return null;
2024-06-07 20:17:03 +03:00
}