25 lines
543 B
TypeScript
Raw Normal View History

2019-12-07 13:28:52 +02:00
import React from 'react';
import { Route, RouteProps } from 'react-router-dom';
import AuthFlowRouteContents from './AuthFlowRouteContents';
export default function AuthFlowRoute(props: RouteProps) {
const { component: Component, ...routeProps } = props;
2019-12-10 09:47:32 +02:00
if (!Component) {
throw new Error('props.component required');
}
2019-12-07 13:28:52 +02:00
return (
<Route
{...routeProps}
render={routerProps => (
<AuthFlowRouteContents
routerProps={routerProps}
component={Component}
/>
)}
/>
);
}