UNPKG

662 BPlain TextView Raw
1import React, {ReactNode} from 'react';
2
3import createRoute, { IRouteArgs, IRouteProps } from '../route/route-component';
4
5export const SECUREDSERVICE_INSTANCE_TYPE = "SecuredServiceComponent";
6
7
8/**
9 * The SecuredRoute takes the same arguments as the Route!
10 *
11 * @param props
12 */
13export default (props: IRouteArgs | any) => {
14
15 return Object.assign(props, createRoute(props), {
16 // we overwrite the type
17 instanceType: SECUREDSERVICE_INSTANCE_TYPE,
18
19 isSecured: true
20 });
21
22
23};
24
25export const isSecuredService = (component) => {
26
27 return component !== undefined &&
28 component.instanceType === SECUREDSERVICE_INSTANCE_TYPE;
29};
\No newline at end of file