1 | import React, {ReactNode} from 'react';
|
2 |
|
3 | import createRoute, { IRouteArgs, IRouteProps } from '../route/route-component';
|
4 |
|
5 | export const SECUREDROUTE_INSTANCE_TYPE = "SecuredRouteComponent";
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 | export default (props: IRouteArgs | any) => {
|
14 |
|
15 | return Object.assign(props, createRoute(props), {
|
16 |
|
17 | instanceType: SECUREDROUTE_INSTANCE_TYPE,
|
18 |
|
19 | isSecured: true
|
20 | });
|
21 |
|
22 |
|
23 | };
|
24 |
|
25 | export const isSecuredRoute = (component) => {
|
26 |
|
27 | return component !== undefined &&
|
28 | component.instanceType === SECUREDROUTE_INSTANCE_TYPE;
|
29 | }; |
\ | No newline at end of file |