2024-12-14 13:16:29 +01:00
|
|
|
import React, { FC, ComponentType } from 'react';
|
|
|
|
import { Route, RouteProps, RouteComponentProps } from 'react-router-dom';
|
2019-12-07 13:28:52 +02:00
|
|
|
|
|
|
|
import AuthFlowRouteContents from './AuthFlowRouteContents';
|
|
|
|
|
2024-12-10 20:42:06 +01:00
|
|
|
// Make "component" prop required
|
2024-12-14 13:16:29 +01:00
|
|
|
type Props = Omit<RouteProps, 'component'> & {
|
|
|
|
component: ComponentType<RouteComponentProps>;
|
|
|
|
};
|
2019-12-10 09:47:32 +02:00
|
|
|
|
2024-12-10 20:42:06 +01:00
|
|
|
const AuthFlowRoute: FC<Props> = ({ component: Component, ...props }) => {
|
2020-05-24 02:08:24 +03:00
|
|
|
return (
|
2024-12-14 13:16:29 +01:00
|
|
|
<Route {...props} render={(routerProps) => <AuthFlowRouteContents component={Component} {...routerProps} />} />
|
2020-05-24 02:08:24 +03:00
|
|
|
);
|
2024-12-10 20:42:06 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
export default AuthFlowRoute;
|