Skip to content

Commit 1efc162

Browse files
committed
fix: new challenge not working
1 parent 23b4909 commit 1efc162

File tree

1 file changed

+40
-42
lines changed

1 file changed

+40
-42
lines changed

src/routes.js

Lines changed: 40 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -150,56 +150,54 @@ class Routes extends React.Component {
150150

151151
return (
152152
<IdleTimer ref={ref => { this.idleTimer = ref }} timeout={1000 * 60 * IDLE_TIMEOUT_MINUTES} onIdle={this.handleOnIdle} debounce={250}>
153-
<Switch>
154-
{!isAllowed &&
153+
{!isAllowed && <Switch>
155154
<Route exact path='/'
156155
render={() => renderApp(
157156
<Challenges menu='NULL' warnMessage={'You are not authorized to use this application'} />,
158157
<TopBarContainer />,
159158
<Sidebar />
160159
)()}
161-
/>}
162-
163-
{isAllowed && <>
164-
<Route exact path='/'
165-
render={() => renderApp(
166-
<Challenges menu='NULL' />,
167-
<TopBarContainer />,
168-
<Sidebar />
169-
)()}
170-
/>
171-
<Route exact path='/self-service'
172-
render={() => renderApp(
173-
<Challenges selfService />,
174-
<TopBarContainer />,
175-
<Sidebar selfService />
176-
)()}
177-
/>
178-
<Route exact path='/projects/:projectId/challenges/new'
179-
render={({ match }) => renderApp(
180-
<ChallengeEditor />,
181-
<TopBarContainer />,
182-
<Sidebar projectId={match.params.projectId} menu={'New Challenge'} />
183-
)()} />
184-
<Route exact path='/challenges/:challengeId' component={ConnectRedirectToChallenge} />
185-
<Route
186-
path='/projects/:projectId/challenges/:challengeId'
187-
render={({ match }) => renderApp(
188-
<ChallengeEditor />,
189-
<TopBarContainer />,
190-
<Sidebar projectId={match.params.projectId} menu={'New Challenge'} />
191-
)()} />
192-
<Route exact path='/projects/:projectId/challenges'
193-
render={({ match }) => renderApp(
194-
<Challenges projectId={match.params.projectId} />,
195-
<TopBarContainer projectId={match.params.projectId} />,
196-
<Sidebar projectId={match.params.projectId} />
197-
)()} />
198-
</>}
199-
160+
/>
161+
<Redirect to='/' />
162+
</Switch>}
163+
{isAllowed && <Switch>
164+
<Route exact path='/'
165+
render={() => renderApp(
166+
<Challenges menu='NULL' />,
167+
<TopBarContainer />,
168+
<Sidebar />
169+
)()}
170+
/>
171+
<Route exact path='/self-service'
172+
render={() => renderApp(
173+
<Challenges selfService />,
174+
<TopBarContainer />,
175+
<Sidebar selfService />
176+
)()}
177+
/>
178+
<Route exact path='/projects/:projectId/challenges/new'
179+
render={({ match }) => renderApp(
180+
<ChallengeEditor />,
181+
<TopBarContainer />,
182+
<Sidebar projectId={match.params.projectId} menu={'New Challenge'} />
183+
)()} />
184+
<Route exact path='/challenges/:challengeId' component={ConnectRedirectToChallenge} />
185+
<Route
186+
path='/projects/:projectId/challenges/:challengeId'
187+
render={({ match }) => renderApp(
188+
<ChallengeEditor />,
189+
<TopBarContainer />,
190+
<Sidebar projectId={match.params.projectId} menu={'New Challenge'} />
191+
)()} />
192+
<Route exact path='/projects/:projectId/challenges'
193+
render={({ match }) => renderApp(
194+
<Challenges projectId={match.params.projectId} />,
195+
<TopBarContainer projectId={match.params.projectId} />,
196+
<Sidebar projectId={match.params.projectId} />
197+
)()} />
200198
{/* If path is not defined redirect to landing page */}
201199
<Redirect to='/' />
202-
</Switch>
200+
</Switch>}
203201
{this.state.showIdleModal && modal}
204202
</IdleTimer>
205203
)

0 commit comments

Comments
 (0)