import { Route } from 'react-router-dom'; import DefaultLayout from '../../../components/layouts/default_layout'; import BundleColumnError from '../../../components/bundle_column_error'; import Bundle from './bundle'; import { me } from '../../../initial_state'; import ColumnIndicator from '../../../components/column_indicator'; export default class WrappedRoute extends Component { static propTypes = { component: PropTypes.func.isRequired, page: PropTypes.func, content: PropTypes.node, componentParams: PropTypes.object, layout: PropTypes.object, publicRoute: PropTypes.bool, }; static defaultProps = { componentParams: {}, }; renderComponent = ({ match }) => { const { component, content, componentParams, layout, page: Page } = this.props; if (Page) { return ( {Component => ( {content} ) } ); } return ( {Component => ( {content} ) } ); } renderLoading = () => { return
} renderError = (props) => { return ; } render() { const { component: Component, content, publicRoute, ...rest } = this.props; if (!publicRoute && !me) { const actualUrl = encodeURIComponent(this.props.computedMatch.url); return { window.location.href = `/auth/sign_in?redirect_uri=${actualUrl}`; return null; }} /> } return ; } }