20 lines
533 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) {
2020-05-24 02:08:24 +03:00
const { component: Component, ...routeProps } = props;
2019-12-07 13:28:52 +02:00
2020-05-24 02:08:24 +03:00
if (!Component) {
throw new Error('props.component required');
}
2019-12-10 09:47:32 +02:00
2020-05-24 02:08:24 +03:00
return (
<Route
{...routeProps}
render={(routerProps) => <AuthFlowRouteContents routerProps={routerProps} component={Component} />}
2019-12-07 13:28:52 +02:00
/>
2020-05-24 02:08:24 +03:00
);
2019-12-07 13:28:52 +02:00
}