header_footer_template_route.jsx 1.19 KB
Newer Older
1 2
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20

import React from 'react';
import {Route} from 'react-router-dom';

import HeaderFooterTemplate from 'bundle-loader?lazy!components/header_footer_template';
import loadLoggedIn from 'bundle-loader?lazy!components/logged_in';
import {AsyncComponent} from 'components/async_load';

export const HFTRoute = ({component: Component, ...rest}) => (
    <Route
        {...rest}
        render={(props) => (
            <AsyncComponent
                doLoad={HeaderFooterTemplate}
                {...props}
            >
                <Component {...props}/>
            </AsyncComponent>
21
        )}
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
    />
);

export const LoggedInHFTRoute = ({component: Component, ...rest}) => (
    <Route
        {...rest}
        render={(props) => (
            <AsyncComponent
                doLoad={loadLoggedIn}
                {...props}
            >
                <AsyncComponent
                    doLoad={HeaderFooterTemplate}
                    {...props}
                >
                    <Component {...props}/>
                </AsyncComponent>
            </AsyncComponent>
40
        )}
41 42
    />
);