1
0
mirror of https://github.com/sasjs/adapter.git synced 2026-01-16 16:40:06 +00:00

feat(*): recreate package with new name

This commit is contained in:
Krishna Acondy
2020-07-07 19:53:35 +01:00
commit 066f953863
150 changed files with 48625 additions and 0 deletions

View File

@@ -0,0 +1,23 @@
import React, { ReactElement, useContext, FunctionComponent } from "react";
import { Redirect, Route } from "react-router-dom";
import { AppContext } from "./context/AppContext";
interface PrivateRouteProps {
component: FunctionComponent;
exact?: boolean;
path: string;
}
const PrivateRoute = (
props: PrivateRouteProps
): ReactElement<PrivateRouteProps> => {
const { component, path, exact } = props;
const appContext = useContext(AppContext);
return appContext.isLoggedIn ? (
<Route component={component} path={path} exact={exact} />
) : (
<Redirect to="/login" />
);
};
export default PrivateRoute;