Skip to content

Commit 11e561e

Browse files
committed
Revert "fix: new challenge not working"
This reverts commit 1efc162.
1 parent 44fe603 commit 11e561e

File tree

1 file changed

+42
-40
lines changed

1 file changed

+42
-40
lines changed

src/routes.js

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

147147
return (
148148
<IdleTimer ref={ref => { this.idleTimer = ref }} timeout={1000 * 60 * IDLE_TIMEOUT_MINUTES} onIdle={this.handleOnIdle} debounce={250}>
149-
{!isAllowed && <Switch>
149+
<Switch>
150+
{!isAllowed &&
150151
<Route exact path='/'
151152
render={() => renderApp(
152153
<Challenges menu='NULL' warnMessage={'You are not authorized to use this application'} />,
153154
<TopBarContainer />,
154155
<Sidebar />
155156
)()}
156-
/>
157-
<Redirect to='/' />
158-
</Switch>}
159-
{isAllowed && <Switch>
160-
<Route exact path='/'
161-
render={() => renderApp(
162-
<Challenges menu='NULL' />,
163-
<TopBarContainer />,
164-
<Sidebar />
165-
)()}
166-
/>
167-
<Route exact path='/self-service'
168-
render={() => renderApp(
169-
<Challenges selfService />,
170-
<TopBarContainer />,
171-
<Sidebar selfService />
172-
)()}
173-
/>
174-
<Route exact path='/projects/:projectId/challenges/new'
175-
render={({ match }) => renderApp(
176-
<ChallengeEditor />,
177-
<TopBarContainer />,
178-
<Sidebar projectId={match.params.projectId} menu={'New Challenge'} />
179-
)()} />
180-
<Route exact path='/challenges/:challengeId' component={ConnectRedirectToChallenge} />
181-
<Route
182-
path='/projects/:projectId/challenges/:challengeId'
183-
render={({ match }) => renderApp(
184-
<ChallengeEditor />,
185-
<TopBarContainer />,
186-
<Sidebar projectId={match.params.projectId} menu={'New Challenge'} />
187-
)()} />
188-
<Route exact path='/projects/:projectId/challenges'
189-
render={({ match }) => renderApp(
190-
<Challenges projectId={match.params.projectId} />,
191-
<TopBarContainer projectId={match.params.projectId} />,
192-
<Sidebar projectId={match.params.projectId} />
193-
)()} />
157+
/>}
158+
159+
{isAllowed && <>
160+
<Route exact path='/'
161+
render={() => renderApp(
162+
<Challenges menu='NULL' />,
163+
<TopBarContainer />,
164+
<Sidebar />
165+
)()}
166+
/>
167+
<Route exact path='/self-service'
168+
render={() => renderApp(
169+
<Challenges selfService />,
170+
<TopBarContainer />,
171+
<Sidebar selfService />
172+
)()}
173+
/>
174+
<Route exact path='/projects/:projectId/challenges/new'
175+
render={({ match }) => renderApp(
176+
<ChallengeEditor />,
177+
<TopBarContainer />,
178+
<Sidebar projectId={match.params.projectId} menu={'New Challenge'} />
179+
)()} />
180+
<Route exact path='/challenges/:challengeId' component={ConnectRedirectToChallenge} />
181+
<Route
182+
path='/projects/:projectId/challenges/:challengeId'
183+
render={({ match }) => renderApp(
184+
<ChallengeEditor />,
185+
<TopBarContainer />,
186+
<Sidebar projectId={match.params.projectId} menu={'New Challenge'} />
187+
)()} />
188+
<Route exact path='/projects/:projectId/challenges'
189+
render={({ match }) => renderApp(
190+
<Challenges projectId={match.params.projectId} />,
191+
<TopBarContainer projectId={match.params.projectId} />,
192+
<Sidebar projectId={match.params.projectId} />
193+
)()} />
194+
</>}
195+
194196
{/* If path is not defined redirect to landing page */}
195197
<Redirect to='/' />
196-
</Switch>}
198+
</Switch>
197199
{this.state.showIdleModal && modal}
198200
</IdleTimer>
199201
)

0 commit comments

Comments
 (0)