aboutsummaryrefslogblamecommitdiffstats
path: root/src/utils/PrivateRoute.jsx
blob: b57bcf53d0161544a4d12ba1c7f0a377b3a02fe2 (plain) (tree)
1
2
3
4
5
6
7
8
9








                                                
import React from 'react';
import { Navigate } from 'react-router-dom';

const PrivateRoute = ({ children }) => {
  const token = localStorage.getItem('token');
  return token ? children : <Navigate to="/" />;
};

export default PrivateRoute;