first commit

This commit is contained in:
Harish Sargar
2025-04-01 20:28:04 +05:30
commit 0e1281aaa8
313 changed files with 85792 additions and 0 deletions

11
src/ProtectedRoute.js Normal file
View File

@@ -0,0 +1,11 @@
import React from "react";
import { Navigate } from "react-router-dom";
import { getToken } from "utils/tokenService";
const ProtectedRoute = ({ children }) => {
console.log(`token for checking whether authenticated: ${getToken()}`);
const isAuthenticated = getToken() !== null; // Check if user is authenticated
return isAuthenticated ? children : <Navigate to="/auth/login" replace />;
};
export default ProtectedRoute;