Implement activation requirement for protected routes
- Added a new `useRequireActivated` hook to enforce user activation before accessing certain routes, redirecting unauthenticated users to the login page and inactive users to the dashboard. - Updated the `InstructionsPage` and `NewsPage` components to utilize the new activation check, enhancing user flow and security. - Conditional rendering of navigation links in the `RootLayout` based on user activation status, improving user experience by hiding inaccessible features.
This commit is contained in:
@@ -1,13 +1,13 @@
|
||||
import { createFileRoute } from '@tanstack/react-router'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
import { useRequireAuth } from '@/features/auth/guards'
|
||||
import { useRequireActivated } from '@/features/auth/guards'
|
||||
import { NewsFeed } from '@/features/news/NewsFeed'
|
||||
|
||||
export const Route = createFileRoute('/news')({ component: NewsPage })
|
||||
|
||||
function NewsPage() {
|
||||
const { t } = useTranslation()
|
||||
const { isReady } = useRequireAuth()
|
||||
const { isReady } = useRequireActivated()
|
||||
|
||||
if (!isReady) return null
|
||||
|
||||
|
||||
Reference in New Issue
Block a user