feat: authorize routes added

This commit is contained in:
2025-08-16 00:01:03 +03:30
parent e9b43b9e53
commit 2ad191064e
7 changed files with 41 additions and 7 deletions

View File

@@ -0,0 +1,13 @@
import { getAccessToken } from '@/lib/apiClient';
import { type PropsWithChildren } from 'react';
import { Navigate } from 'react-router-dom';
export const ProtectedRoute = ({ children }: PropsWithChildren) => {
if (!getAccessToken()) {
// If no token, redirect to login page
return <Navigate to="/login" replace />;
}
// If token exists, render the children components
return children;
};