17 lines
368 B
JavaScript
17 lines
368 B
JavaScript
import React from "react";
|
|
import { Route, Redirect } from "react-router-dom";
|
|
export default ({ component: Component, isAuthorized, ...rest }) => {
|
|
return (
|
|
<Route
|
|
{...rest}
|
|
render={props =>
|
|
isAuthorized === true ? (
|
|
<Component {...props} />
|
|
) : (
|
|
<Redirect to="/unauthorized" />
|
|
)
|
|
}
|
|
/>
|
|
);
|
|
};
|