mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-15 20:30:33 +00:00
20 lines
511 B
TypeScript
20 lines
511 B
TypeScript
// @ts-nocheck
|
|
import React from 'react';
|
|
import BodyClassName from 'react-body-classname';
|
|
import { Redirect } from 'react-router-dom';
|
|
import { useIsAuthenticated } from '@/hooks/state';
|
|
|
|
export default function PrivateRoute({ component: Component, ...rest }) {
|
|
const isAuthenticated = useIsAuthenticated();
|
|
|
|
return (
|
|
<BodyClassName className={''}>
|
|
{isAuthenticated ? (
|
|
<Component />
|
|
) : (
|
|
<Redirect to={{ pathname: '/auth/login' }} />
|
|
)}
|
|
</BodyClassName>
|
|
);
|
|
}
|