Files
relay-saas/web/air/src/components/PrivateRoute.js
huangzhenpc cb7c48bfa7
Some checks failed
CI / Unit tests (push) Has been cancelled
CI / commit_lint (push) Has been cancelled
first commit: one-api base code + SAAS plan document
2025-12-29 22:52:27 +08:00

13 lines
285 B
JavaScript

import { Navigate } from 'react-router-dom';
import { history } from '../helpers';
function PrivateRoute({ children }) {
if (!localStorage.getItem('user')) {
return <Navigate to="/login" state={{ from: history.location }} />;
}
return children;
}
export { PrivateRoute };