accounts-frontend/packages/app/containers/AuthFlowRoute.tsx

25 lines
545 B
TypeScript
Raw Normal View History

2019-12-07 16:58:52 +05:30
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 13:17:32 +05:30
if (!Component) {
throw new Error('props.component required');
}
2019-12-07 16:58:52 +05:30
return (
<Route
{...routeProps}
render={(routerProps) => (
2019-12-07 16:58:52 +05:30
<AuthFlowRouteContents
routerProps={routerProps}
component={Component}
/>
)}
/>
);
}