mirror of
https://github.com/opencloud-eu/opencloud.git
synced 2026-04-25 05:28:20 -05:00
23 lines
507 B
JavaScript
23 lines
507 B
JavaScript
import React from 'react';
|
|
import PropTypes from 'prop-types';
|
|
import { Route } from 'react-router-dom';
|
|
|
|
import RedirectWithQuery from './RedirectWithQuery';
|
|
|
|
const PrivateRoute = ({ component: Target, hello, ...rest }) => (
|
|
<Route {...rest} render={props => (
|
|
hello ? (
|
|
<Target {...props}/>
|
|
) : (
|
|
<RedirectWithQuery target='/identifier' />
|
|
)
|
|
)}/>
|
|
);
|
|
|
|
PrivateRoute.propTypes = {
|
|
component: PropTypes.func.isRequired,
|
|
hello: PropTypes.object
|
|
};
|
|
|
|
export default PrivateRoute;
|