|
@@ -70,6 +70,12 @@ class Tracim extends React.Component {
|
70
|
70
|
render () {
|
71
|
71
|
const { props } = this
|
72
|
72
|
|
|
73
|
+ if (props.user.logged === null) return null // @TODO show loader
|
|
74
|
+
|
|
75
|
+ if (props.user.logged === false && props.location.pathname !== '/login') {
|
|
76
|
+ return <Redirect to={{pathname: '/login', state: {from: props.location}}} />
|
|
77
|
+ }
|
|
78
|
+
|
73
|
79
|
return (
|
74
|
80
|
<div className='tracim'>
|
75
|
81
|
<Header />
|
|
@@ -89,34 +95,29 @@ class Tracim extends React.Component {
|
89
|
95
|
}
|
90
|
96
|
}} />
|
91
|
97
|
|
92
|
|
- { props.user.logged
|
93
|
|
- ? (
|
94
|
|
- <Route path='/workspaces/:idws?' render={() => // Workspace Router
|
95
|
|
- <div className='sidebarpagecontainer'>
|
96
|
|
- <Sidebar />
|
97
|
|
-
|
98
|
|
- <Route exact path={PAGE.WORKSPACE.ROOT} render={() => props.workspaceList.length === 0 // handle '/' and redirect to first workspace
|
99
|
|
- ? null
|
100
|
|
- : <Redirect to={{pathname: `/workspaces/${props.workspaceList[0].id}/contents`, state: {from: props.location}}} />
|
101
|
|
- } />
|
102
|
|
-
|
103
|
|
- <Route exact path={`${PAGE.WORKSPACE.ROOT}/:idws`} render={props2 => // handle '/workspaces/:id' and add '/contents'
|
104
|
|
- <Redirect to={{pathname: `/workspaces/${props2.match.params.idws}/contents`, state: {from: props.location}}} />
|
105
|
|
- } />
|
106
|
|
-
|
107
|
|
- <Route path={PAGE.WORKSPACE.DASHBOARD(':idws')} component={Dashboard} />
|
108
|
|
- <Route path={PAGE.WORKSPACE.CALENDAR(':idws')} component={() => <div><br /><br /><br /><br />NYI</div>} />
|
109
|
|
- <Route path={PAGE.WORKSPACE.CONTENT(':idws', ':type', ':idcts')} component={WorkspaceContent} />
|
110
|
|
- <Route exact path={PAGE.WORKSPACE.CONTENT_LIST(':idws')} component={WorkspaceContent} />
|
111
|
|
-
|
112
|
|
- <Route path={PAGE.ACCOUNT} component={Account} />
|
113
|
|
- <Route path={PAGE.ADMIN.ROOT} component={AppFullscreenManager} />
|
114
|
|
- </div>
|
|
98
|
+ <Route path='/workspaces/:idws?' render={() => // Workspace Router
|
|
99
|
+ <div className='sidebarpagecontainer'>
|
|
100
|
+ <Sidebar />
|
|
101
|
+
|
|
102
|
+ <Route exact path={PAGE.WORKSPACE.ROOT} render={() => props.workspaceList.length === 0 // handle '/' and redirect to first workspace
|
|
103
|
+ ? null // @FIXME this needs to be handled in case of new user that has no workspace
|
|
104
|
+ : <Redirect to={{pathname: `/workspaces/${props.workspaceList[0].id}/contents`, state: {from: props.location}}} />
|
115
|
105
|
} />
|
116
|
|
- )
|
117
|
|
- : props.user.logged === false && props.location.pathname !== '/login' &&
|
118
|
|
- <Redirect to={{pathname: '/login', state: {from: props.location}}} />
|
119
|
|
- }
|
|
106
|
+
|
|
107
|
+ <Route exact path={`${PAGE.WORKSPACE.ROOT}/:idws`} render={props2 => // handle '/workspaces/:id' and add '/contents'
|
|
108
|
+ <Redirect to={{pathname: `/workspaces/${props2.match.params.idws}/contents`, state: {from: props.location}}} />
|
|
109
|
+ } />
|
|
110
|
+
|
|
111
|
+ <Route path={PAGE.WORKSPACE.DASHBOARD(':idws')} component={Dashboard} />
|
|
112
|
+ <Route path={PAGE.WORKSPACE.CALENDAR(':idws')} component={() => <div><br /><br /><br /><br />NYI</div>} />
|
|
113
|
+ <Route path={PAGE.WORKSPACE.CONTENT(':idws', ':type', ':idcts')} component={WorkspaceContent} />
|
|
114
|
+ <Route exact path={PAGE.WORKSPACE.CONTENT_LIST(':idws')} component={WorkspaceContent} />
|
|
115
|
+ </div>
|
|
116
|
+ } />
|
|
117
|
+
|
|
118
|
+ <Route path={PAGE.ACCOUNT} component={Account} />
|
|
119
|
+
|
|
120
|
+ <Route path={PAGE.ADMIN.ROOT} component={AppFullscreenManager} />
|
120
|
121
|
|
121
|
122
|
<Route path='/admin_temp/workspace' component={AdminWorkspacePage} />
|
122
|
123
|
|