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

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