summaryrefslogtreecommitdiffstats
path: root/webapp/routes/route_root.jsx
diff options
context:
space:
mode:
authorChristopher Speller <crspeller@gmail.com>2016-06-22 10:30:01 -0400
committerGitHub <noreply@github.com>2016-06-22 10:30:01 -0400
commit14510ce19470c176a7f286d4a3238e813f7dc959 (patch)
tree3aeb058bd9fc0395a040785c876a2762e523df96 /webapp/routes/route_root.jsx
parent00dc8e734c5af9e2a7de778b60a2eeaa0e1be269 (diff)
downloadchat-14510ce19470c176a7f286d4a3238e813f7dc959.tar.gz
chat-14510ce19470c176a7f286d4a3238e813f7dc959.tar.bz2
chat-14510ce19470c176a7f286d4a3238e813f7dc959.zip
Adding webpack code splitting (#3377)
Diffstat (limited to 'webapp/routes/route_root.jsx')
-rw-r--r--webapp/routes/route_root.jsx123
1 files changed, 123 insertions, 0 deletions
diff --git a/webapp/routes/route_root.jsx b/webapp/routes/route_root.jsx
new file mode 100644
index 000000000..6593e2bd8
--- /dev/null
+++ b/webapp/routes/route_root.jsx
@@ -0,0 +1,123 @@
+// Copyright (c) 2016 Mattermost, Inc. All Rights Reserved.
+// See License.txt for license information.
+
+import * as RouteUtils from 'routes/route_utils.jsx';
+
+import Root from 'components/root.jsx';
+
+import claimAccountRoute from 'routes/route_claim.jsx';
+import createTeamRoute from 'routes/route_create_team.jsx';
+import teamRoute from 'routes/route_team.jsx';
+
+import ErrorStore from 'stores/error_store.jsx';
+function preLoggedIn(nextState, replace, callback) {
+ ErrorStore.clearLastError();
+ callback();
+}
+
+export default {
+ path: '/',
+ component: Root,
+ getChildRoutes: RouteUtils.createGetChildComponentsFunction(
+ [
+ {
+ getComponents: (location, callback) => {
+ System.import('components/header_footer_template.jsx').then(RouteUtils.importComponentSuccess(callback));
+ },
+ getChildRoutes: RouteUtils.createGetChildComponentsFunction(
+ [
+ {
+ path: 'login',
+ getComponents: (location, callback) => {
+ System.import('components/login/login_controller.jsx').then(RouteUtils.importComponentSuccess(callback));
+ }
+ },
+ {
+ path: 'reset_password',
+ getComponents: (location, callback) => {
+ System.import('components/password_reset_send_link.jsx').then(RouteUtils.importComponentSuccess(callback));
+ }
+ },
+ {
+ path: 'reset_password_complete',
+ getComponents: (location, callback) => {
+ System.import('components/password_reset_form.jsx').then(RouteUtils.importComponentSuccess(callback));
+ }
+ },
+ claimAccountRoute,
+ {
+ path: 'signup_user_complete',
+ getComponents: (location, callback) => {
+ System.import('components/signup_user_complete.jsx').then(RouteUtils.importComponentSuccess(callback));
+ }
+ },
+ {
+ path: 'should_verify_email',
+ getComponents: (location, callback) => {
+ System.import('components/should_verify_email.jsx').then(RouteUtils.importComponentSuccess(callback));
+ }
+ },
+ {
+ path: 'do_verify_email',
+ getComponents: (location, callback) => {
+ System.import('components/do_verify_email.jsx').then(RouteUtils.importComponentSuccess(callback));
+ }
+ }
+ ]
+ )
+ },
+ {
+ path: 'error',
+ getComponents: (location, callback) => {
+ System.import('components/error_page.jsx').then(RouteUtils.importComponentSuccess(callback));
+ }
+ },
+ {
+ getComponents: (location, callback) => {
+ System.import('components/logged_in.jsx').then(RouteUtils.importComponentSuccess(callback));
+ },
+ onEnter: preLoggedIn,
+ getChildRoutes: RouteUtils.createGetChildComponentsFunction(
+ [
+ {
+ path: 'admin_console',
+ getComponents: (location, callback) => {
+ System.import('components/admin_console/admin_console.jsx').then(RouteUtils.importComponentSuccess(callback));
+ },
+ indexRoute: {onEnter: (nextState, replace) => replace('/admin_console/system_analytics')},
+ getChildRoutes: (location, callback) => {
+ System.import('routes/route_admin_console.jsx').then((comp) => callback(null, comp.default));
+ }
+ },
+ {
+ getComponents: (location, callback) => {
+ System.import('components/header_footer_template.jsx').then(RouteUtils.importComponentSuccess(callback));
+ },
+ getChildRoutes: RouteUtils.createGetChildComponentsFunction(
+ [
+ {
+ path: 'select_team',
+ getComponents: (location, callback) => {
+ System.import('components/select_team/select_team.jsx').then(RouteUtils.importComponentSuccess(callback));
+ }
+ },
+ createTeamRoute
+ ]
+ )
+ },
+ teamRoute
+ ]
+ )
+ },
+ {
+ path: '*',
+ onEnter: (nextState, replace) => {
+ replace({
+ pathname: 'error',
+ query: RouteUtils.notFoundParams
+ });
+ }
+ }
+ ]
+ )
+};